views:

268

answers:

2

Greetings! I'm trying to add simple mail functionality to a little web app and I'm stuck. I'm able to send email from the terminal to myself on local machine just fine, but when I try to run the app I get "Connection refused: 61"

At first I thought my setting are messed up, I kept playing with them for a while and for now decided to give up at this point:

$this->Email->smtpOptions = array(
   'port'=>'25',
   'timeout'=>'30',
   'host' => 'user-power-mac-g5.local',
   'username'=>'',
   'password'=>'',
   'client' => '[email protected]'
)

$this->Email->delivery = 'smtp';

$User = "some user"; 
$this->Email->to = '[email protected]';

$this->Email->subject = 'Welcome';
$this->Email->replyTo = '[email protected]';
$this->Email->from = 'Web App <[email protected]>';
$this->Email->sendAs = 'text'; 
$this->set('User', $User);
$this->Email->send();
$this->set('smtp-errors', $this->Email->smtpError);

I'm trying to run this on an XAMPP with cakePHP 1.2.5 and only the core mail comp. Thanks in advance!

A: 

Many ISPs block port 25 to prevent spam. You might want to try using the alternate SMTP port - 587 is the most common. If that doesn't work, then maybe using sendmail instead of SMTP might work.

jimiyash
Thank! Tried the alt port - no joy, commented out SMTP details and delivery - and it works like a charm, at least on the local dev machine. We'll see what happens in the wild :-)
vector
great glad i could help
jimiyash
A: 

thanks to both of you for posting about commenting out SMTP... didn't think it'd work without it... now I'm wondering why I need smtp... anyway... totally fixed my problem too. thanks guys.

Will