Php.ini and mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kdalts3759
Forum Newbie
Posts: 4
Joined: Wed Mar 07, 2012 4:27 am

Php.ini and mail

Post 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?
User avatar
Robert07
Forum Contributor
Posts: 113
Joined: Tue Jun 17, 2008 1:41 pm

Re: Php.ini and mail

Post 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.
Post Reply