28rain Posted December 16, 2008 Share Posted December 16, 2008 The book i am using to learn is full of funny random errors whicj i need help fixing. OK this is my ini config for the smtp: [mail function] ; For Win32 only. SMTP = smtp.googlemail.com smtp_port = 25 ; For Win32 only. ;sendmail_from = william.kelsey@gmail.com and i am using localhost 127.0.0.1 to test my scripting, yet i get this error: Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.googlemail.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\send_simpleform.php on line 16 and the firewall is turned off. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/ Share on other sites More sharing options...
ngreenwood6 Posted December 16, 2008 Share Posted December 16, 2008 I think that you are using the wrong smtp server. it should be SMTP = smtp.gmail.com also you need to take out the ; in front of the sendmail_from. the ; makes it bypass that line. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-716899 Share on other sites More sharing options...
revraz Posted December 16, 2008 Share Posted December 16, 2008 Sounds like you need to contact Google to get the right address and port. I don't think they allow mail on port 25, pretty sure they use authentication on a port like 295 or 995. Either way, check their site since this has nothing to do with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-716998 Share on other sites More sharing options...
premiso Posted December 16, 2008 Share Posted December 16, 2008 Also a note, google requires the use of TLS (I believe it is) and the port is something in the 900's. Read at googles site on howto setup Outlook to send emails. You also have to authenticate yourself with a username/password. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-717056 Share on other sites More sharing options...
revraz Posted December 16, 2008 Share Posted December 16, 2008 Isn't that what I just said? Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-717063 Share on other sites More sharing options...
premiso Posted December 16, 2008 Share Posted December 16, 2008 Isn't that what I just said? Probably, sorry, I had this open from earlier and got side tracked and did not see that my reply did not post so I just it "send" after the verifcation page without checking. My bad. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-717069 Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2008 Share Posted December 17, 2008 And since the php mail() function does not support SMTP Authentication, you will need to use one the mailer classes like phpmailer. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-717211 Share on other sites More sharing options...
28rain Posted December 21, 2008 Author Share Posted December 21, 2008 Yeah thanks guys the only change which helped me really was taking the semi colon out i had thought that there might be a change in port but thanks for telling me to use the tls one not the other one!. Now i get this error do you need to see my script to see the problem?? 530 5.7.0 Must issue a STARTTLS command first. i6sm3420993gve.26 Its on line 16 where i have: mail($to, $subject, $msg, $mailheaders); Thanks a mill guys Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-720698 Share on other sites More sharing options...
trq Posted December 21, 2008 Share Posted December 21, 2008 See the reply above your last one. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-720742 Share on other sites More sharing options...
PFMaBiSmAd Posted December 21, 2008 Share Posted December 21, 2008 Read the "Outgoing Mail (SMTP) Server" information at this link to find out which port you need to use - "http://mail.google.com/support/bin/answer.py?hl=en&answer=13287 Yes, post your current code, it could be doing any number of things right and wrong. Edit: And since you are still using the php mail() function, you won't be able to get this to work until you switch to use one of the php mailer classes that will allow you to use SMTP authentication. Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-720767 Share on other sites More sharing options...
28rain Posted December 23, 2008 Author Share Posted December 23, 2008 OK heres my script but i tell you there are no errors... P.s the html one is fine but if you really want to see that aswell. Please can you tell me how to intergrate this with php mailer because i have downloaded/copied the php mailer files but what next!! <? if (($_POST['sender_name'] == " ") || ($_POST['sender_email'] == " ") || ($_POST['message'] == " ")) { header ("location: simple_form.html"); exit; } $msg = "E-MAIL SENT FROM WWW SITE\n"; $msg .= "Sender's name:\t$_POST[sender_name]\n"; $msg .= "Senders's E-mail:\t$_POST[sender_email]\n"; $msg .= "Message:\t$_POST[message]\n;"; $to = "william.kelsey@gmail.com"; $subject = "Web Site Feedback"; $mailheaders = "From: My Web Site <genericaddress@yourdomain.com>\n"; $mailheaders .= "Reply-To: $_POST[sender_email]\n"; mail($to, $subject, $msg, $mailheaders); ?> <html> <head> <title>Simple Feedback Form Sent</title> </head> <body> <H1>The following e-mail has been sent:</H1> <P>Your Name: <br> <? echo "$_POST[sender_name]"; ?> <P> Your email address is: <br> <? echo "$_POST[sender_email]"; ?> <p> Message: <br> <? echo "$_POST[message]"; ?> </body> Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-722224 Share on other sites More sharing options...
28rain Posted December 23, 2008 Author Share Posted December 23, 2008 Lol ok i see one blatent mistake of me doing too juch copying but what should i change that too?? Quote Link to comment https://forums.phpfreaks.com/topic/137228-smtp-setup-i-know-this-has-been-answered-a-thousand-times-but/#findComment-722228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.