Page 1 of 1

Php.ini and mail

Posted: Fri Apr 20, 2012 5:35 pm
by kdalts3759
Hi Folks

I'm trying to send an email using PHP and I just can't seem to figure this out. I have a simple script to test with that looks like this... really simple stuff..

Code: Select all

$to      = you@somewhere.com'; 
$subject = 'the subject'; 
$message = 'hello'; 
$headers = 'From: me@somewhere.com' . "\r\n" . 
    'Reply-To: me@somewhere.com'  . "\r\n" . 
    'X-Mailer: PHP/' . phpversion(); 

mail($to, $subject, $message, $headers); 
I then dipped into the php.ini file and changed the settings (smtp.blueyonder.co.uk is directly out of my outlook account settings)
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.blueyonder.co.uk
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = me@somewhere.com
All I keep getting back is -
Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.blueyonder.co.uk" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in
The crazy thing is that 1 mail actually came through but now all I keep getting is the error... any clues?

Re: Php.ini and mail

Posted: Sun Apr 22, 2012 2:59 pm
by Robert07
If you are doing this on your PC, typically ISPs block port 25 so any traffic you sent out that port will fall into a black hole. Try using another port, like 26.