Jump to content


Photo

mail function and smtp


  • Please log in to reply
10 replies to this topic

#1 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 14 July 2006 - 07:44 PM

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

#2 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 14 July 2006 - 08:12 PM

Anyone?

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 14 July 2006 - 09:13 PM

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 http://www.myserver.org/portscan.asp .


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.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 14 July 2006 - 09:23 PM

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 83
Your membership information has been mailed to your email address! Please check it and follow the directions! "

Here is lines 81 & 82:
    mail($email, $subject, $message,  
        "From: Tandem<Tandem@localhost>\n"); 

Any idea why this is happening? And would you reccommend mercury instead of this?

#5 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 14 July 2006 - 09:24 PM

If you're using localhost, you need to install a mail server.

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#6 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 14 July 2006 - 09:30 PM

try this

   $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');

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#7 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 14 July 2006 - 09:45 PM

I tried that, and just about everything else i could think of and i keep getting:
Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\Program Files\Apache Group....etc.

Any suggestions? :/

#8 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 14 July 2006 - 09:53 PM

Never used PostCast but that error message seems to be straight forward.

mail($headers, $to, $subject, $message)or die('something went wrong');

Now I may be way off base with that one but give it a go any way.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#9 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 14 July 2006 - 10:27 PM

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 :)

#10 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 15 July 2006 - 01:44 PM

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
Windows IP Configuration





Ethernet 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

*note: only pertinent if using a router

 

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.

SMTP Port 25 Server detected and it is publicly accessible. Your ISP is not blocking port 25.

If you follow the instructions above, reguarding opening port 25 and you still get this message

SMTP Port 25 Unable to detect server on this port
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

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#11 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 15 July 2006 - 10:11 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users