Page 1 of 1

mail server for local host

Posted: Mon Dec 27, 2010 9:07 pm
by bob302
I am a newbie to php and local server testing environment. I have installed Wampserver without issue. I have developed some php scripts for sites and they work pretty well. Now, I am trying to send an email to a user with a code for registration much like is done on this site. However, to my chagrin and I guess embarrassment, I cannot get any of the mail server (free) working. I have tried postcast, send mail, etc. and am having no luck. Is there anyone who can tell me where I might get a good tutorial on how to get a server working or how to change php.ini to utilize my own isp. Thanks....apologize for my ignorance, but would like some advice.
Thanks.

Re: mail server for local host

Posted: Mon Dec 27, 2010 11:38 pm
by social_experiment
Google search results
Take a look at some of these, hth.

Re: mail server for local host

Posted: Tue Dec 28, 2010 7:18 pm
by bob302
I have tried many of these and they all give me the same message about smtp, port error, etc......I have even reinstalled wampserver2 thinking I may have don something wrong.....I read the forums and still get errors. Here is my current config....
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = rlv302@att.net

<?php
$to = "gypsy571@yahoo.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "rlv302@att.net";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Error message received:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\cccga\testmail.php on line 10
Mail Sent. >

ANy help greatly appreciated

Re: mail server for local host

Posted: Wed Dec 29, 2010 7:38 am
by Celauran
bob302 wrote:Here is my current config....
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
Do you have a mail server running locally? For testing purposes, you could always use your ISP's SMTP server, or gmail's or whatever.

Re: mail server for local host

Posted: Wed Dec 29, 2010 8:01 am
by bob302
I do not have a mail server running locally. Tried to intall many of the free ones and was never able to send mail. I am a newbie in that area and could not find one with a tut or instructions. I have tried to use my own ISP as indicated above and received the above errors. Are you aware of a tutorial or how to reconfig ini and what code to include in the script? Thanks so much for looking.
Bob

Re: mail server for local host

Posted: Wed Dec 29, 2010 8:38 am
by Celauran
bob302 wrote:I have tried to use my own ISP as indicated above and received the above errors.
I don't see any examples above that use your ISP, only the one attempting to use a locally installed mail server. Have you tried setting SMTP = smtp.yourisp.com? What errors did that produce? Did you try changing the SMTP port to 587? Any luck with that?

Re: mail server for local host

Posted: Wed Dec 29, 2010 9:04 am
by bob302
tried this.......
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.att.yahoo.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = rlv302@att.net

<?php
$to = "gypsy571@yahoo.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "rlv302@att.net";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.att.yahoo.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\cccga\testmail.php on line 10
Mail Sent. >

will change port and try again

Re: mail server for local host

Posted: Wed Dec 29, 2010 9:24 am
by bob302
interesting simply changed the port to 587 in ini - stopped and restarted wamp2 and I get the same error message indicating port 25.....