Tandem Posted July 14, 2006 Share Posted July 14, 2006 Ok, i'm currently building a website (i'm hosting it on an apache webserver on my computer whilst i complete and test it (if that matters)). When users register their account they are sent an e-mail containing activation details for their account. I'm having trouble trying to get the e-mails to actually send.I'm trying to send the e-mails through my AOL e-mail account for the time being until i complete my site and host it somewhere else. I changed php.ini correctly, but then i realised that AOL requires authentication to send the e-mails. Apparently the mail function doesn't support this....(correct me if i'm wrong).Can anyone suggest a possible solution for me? It doesn't matter what it is as long as the e-mails send :)Thanks-Tandem Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/ Share on other sites More sharing options...
Tandem Posted July 14, 2006 Author Share Posted July 14, 2006 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58086 Share on other sites More sharing options...
tomfmason Posted July 14, 2006 Share Posted July 14, 2006 I maybe wrong but I think that you have to have some kind of mail server set up for the mail() function to work. I recommend that you check to see If your ISP blocks port 25. You can do this by going to [url=http://www.myserver.org/portscan.asp]http://www.myserver.org/portscan.asp[/url] . I would recomend contacting Aohell and seeing if the offer any kind of Smart Host support for out going mail. I am not sure if you can send mail with port 25 being blocked or not. If it is not blocked then you should look into a mail server. I use Mecury Mail Server. There are many of them out there and I am sure most are better the mecury. If you do decide to use mecury. Post back here and I will assit you with setting it up. Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58117 Share on other sites More sharing options...
Tandem Posted July 14, 2006 Author Share Posted July 14, 2006 I just downloaded PostCast mailserver, and configured php.ini to work with it, but now i'm getting this error:"Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\Program Files\Apache Group\Apache2\htdocs\register.php on line 83Your membership information has been mailed to your email address! Please check it and follow the directions! "Here is lines 81 & 82:[code] mail($email, $subject, $message, "From: Tandem<Tandem@localhost>\n"); [/code]Any idea why this is happening? And would you reccommend mercury instead of this? Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58121 Share on other sites More sharing options...
pixy Posted July 14, 2006 Share Posted July 14, 2006 If you're using localhost, you need to install a mail server. Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58122 Share on other sites More sharing options...
tomfmason Posted July 14, 2006 Share Posted July 14, 2006 try this [code=php:0] $headers = "From: you@yoursite.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; mail($to, $subject, $message, $headers)or die('something went wrong');[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58124 Share on other sites More sharing options...
Tandem Posted July 14, 2006 Author Share Posted July 14, 2006 I tried that, and just about everything else i could think of and i keep getting:[code]Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\Program Files\Apache Group....etc.[/code]Any suggestions? :/ Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58129 Share on other sites More sharing options...
tomfmason Posted July 14, 2006 Share Posted July 14, 2006 Never used PostCast but that error message seems to be straight forward. [code=php:0]mail($headers, $to, $subject, $message)or die('something went wrong');[/code]Now I may be way off base with that one but give it a go any way. Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58131 Share on other sites More sharing options...
Tandem Posted July 14, 2006 Author Share Posted July 14, 2006 Ok i managed to stop the errors, but the e-mails aren't being recieved.Surely thats a problem with the server? I'm not really sure, but i've decided that i don't like PostCast and i'm uninstalling it anyway.I'd appreciate it if you could talk me through setting up Mercury :) Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58143 Share on other sites More sharing options...
tomfmason Posted July 15, 2006 Share Posted July 15, 2006 First you will need to find out if your Isp has smart host support. An easy way to tell is if port 25 is blocked. You can follow the link posted above to myserver.org . It is a free service that scans your ports to see if they are blocked by your isp. Before you do this you will also need to, if using windows firewall go to start/control pannel/firewall and click on the exceptions tab. Now under the execptions tab click on add port and add port 25 with the name SMTP.Also, if you are using a router, you will need to enable Port Range Forwarding to the ip address of the box that the mail server will reside. You can find your ip by going to commad prompt with the following command. ipconfig.The out put should look like the [code]Windows IP ConfigurationEthernet adapter Local Area Connection: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : xxx.xxx.xx.xxx Subnet Mask . . . . . . . . . . . : xxx.xxx.xxx.x Default Gateway . . . . . . . . . : xxx.xxx.xx.x[/code][color=red][b][i]*note: only pertinent if using a router[/i][/b][/color] After you do this go to the link above and go throught the port scan. This will bring up a list of your availiable ports If your port 25 is not blocked the message from myserver.org should look like this.[code]SMTP Port 25 Server detected and it is publicly accessible. Your ISP is not blocking port 25.[/code]If you follow the instructions above, reguarding opening port 25 and you still get this message[code]SMTP Port 25 Unable to detect server on this port[/code] or something similar error then ether you did not properly open port 25 or your Isp has blocked it(which is the most likely)If this is the case then you will need to contact your host about Smart Host support or unblocking port 25. Also if you are unwilling or unable to get port 25 unblocked then Mecury Mail server is not for you. I am not sure but I think that you can send mail from another port but I think that you have to have some kind of Smart Host support. If any one else knows if this can be done, please post the answer. This would be good for future refference.Post back here if you are able to open port 25 and I will continue guiding you through the setup process.Also, if anyone knows of any better free mail server, please post or pm me.Thanks and good luck,Tom Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58484 Share on other sites More sharing options...
Tandem Posted July 15, 2006 Author Share Posted July 15, 2006 I'm pretty sure that port 25 is blocked :(The aol smtp server requires AUTH and i don't know how to use this. When i send the mails they are at least recieved by the server even though they cannot be sent to the e-mail address, so i should be able to successfuly build and test my site, which is all i'm looking to do atm. Thanks for your help amyway Tom! Quote Link to comment https://forums.phpfreaks.com/topic/14607-mail-function-and-smtp/#findComment-58696 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.