Re: Mail Function Not Working
| From: | Sascha Meyer | Date: | Mon, 12 Apr 2010 14:19:28 +0000 |
| Subject: | Re: Mail Function Not Working | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-30012@lists.php.net to get a copy of this message | ||
Hi Alice,
Alice wrote:
> I have an issue here where I see no PHP errors on my mail
> function usage, and yet I am not getting the mail in the desired
> account. Here is what I have for my PHP code:
>
> $headers = "From: ajwei@alumni.iu.edu" ;
> $to = $email;
> $subject =
> "Comments Regarding My Site";
> $body = "From: $your_name\n E-Mail:
> $email\n Reason Contact: $question\n Comments:\n $comments";
> mail($to,
> $subject, $body,$headers);
>
> This is what I have in my PHP.ini:
>
> [mail
> function]
> ; For Win32 only.
> SMTP = smtp.live.com
> smtp_port =
> 587
> ...
As Keith and Richard already told, it is not enough to point PHP to an existing mail server, you
also need to take care of proper authentication or relaying of messages.
To get you started, here are two tutorials for sending mails with SMTP authentication (one using a
PEAR class, the other uses sockets instead of the mail function):
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
http://www.codewalkers.com/c/a/Email-Code/Smtp-Auth-Email-Script/
If your provider requires "SMTP after POP", it will be quite tricky (but not impossible)
to send mails with PHP.
Regards,
Sascha
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01