|
Posted by Kenneth Downs on 06/09/05 17:45
joealey2003@yahoo.com wrote:
> Hi all...
>
> A simple mail example like...
>
> <?
> mail("acco...@yahoo.com","Subject of Message","Message");
> ?>
>
> does not work to yahoo or spymac.com, but the same works to gmail and
> other servers.
>
> Yahoo and others does not even receive the message. Inbox and Bulk
> folders stay empty.
>
> Does anybody have an idea why yahoo or other servers does not receive
> the messsage?
I just went through some adventures with this. Perhaps some of what
happened to me may help. My system is Linux, but the ideas should be
generally applicable.
The most important guiding principle is that you are handing information to
a third party, the email server, and therefore you are losing some control,
which you offset with increased logging and alerts.
First, defininitely use Pear Mail instead of mail(). They are not
dramatically different from one another, but I found Pear much easier when
adding more headers, and it just felt smoother when coding. Considering
how much trouble I was having, the small differences were magnified and
Pear Mail suddenly looked mcuh better.
Second, make sure you trap a failure to send. It could be your email server
is off or rejects the mail, so that's the first thing you need to know.
Using Pear, the code is:
$mail_object->send($recipients, $headers, $body);
if (!$mail_object) {
// some action on error
}
else {
// some action on success
} }
Third, make certain that the "FROM" address to the email is reachable by
your mail server no matter what, so that bounced messages will
Fourth, check your server's logs, did they show an attempt to send the mail?
Did they give an error message if failed?
Fifth, if the machine originating the email (your smtp server) is not
identified with a real DNS name, like mail.example.com, then many big shops
like Yahoo and AOL will either route it to Bulk or Spam.
--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Navigation:
[Reply to this message]
|