Connecting Tech Pros Worldwide Help | Site Map

mail() not working to Y but works to Gmail

joealey2003@yahoo.com
Guest
 
Posts: n/a
#1: Jul 17 '05
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?

Alvaro G Vicario
Guest
 
Posts: n/a
#2: Jul 17 '05

re: mail() not working to Y but works to Gmail


*** joealey2003@yahoo.com wrote/escribió (9 Jun 2005 07:02:47 -0700):[color=blue]
> Does anybody have an idea why yahoo or other servers does not receive
> the messsage?[/color]

If your mail server is configured correctly, your mail to Yahoo is probably
being filtered as spam.


--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
joealey2003@yahoo.com
Guest
 
Posts: n/a
#3: Jul 17 '05

re: mail() not working to Y but works to Gmail


but the problem is that bulk mail folder and inbox folder are empty.

and i can send to gmail...

Kenneth Downs
Guest
 
Posts: n/a
#4: Jul 17 '05

re: mail() not working to Y but works to Gmail


joealey2003@yahoo.com wrote:
[color=blue]
> 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?[/color]

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)
Alvaro G Vicario
Guest
 
Posts: n/a
#5: Jul 17 '05

re: mail() not working to Y but works to Gmail


*** joealey2003@yahoo.com wrote/escribió (9 Jun 2005 07:27:51 -0700):[color=blue]
> but the problem is that bulk mail folder and inbox folder are empty.[/color]

I can't speak for Yahoo for I've never used their mail, but some hosts just
reject all mail from servers that do not meet certain (often secret)
conditions:

* IP is not blacklisted.
* Reverse DNS lookup does not resolve to hostname.
* Messages do not include certain words.
* Attachment are not of given type (I know servers that reject ZIP files).

When I said reject I should have said "first accept then drop". Hotmail
used to do so (dropped messages were neither returned nor delivered).

You can do some simple tests:

* Make sure headers include your e-mail address in From field.
* Provide a return address for error messages*.
* Try to send mail through the same server from another client.

(*) mail($to, $subject, $body, "From: $from", "-f$from");

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
joealey2003@yahoo.com
Guest
 
Posts: n/a
#6: Jul 17 '05

re: mail() not working to Y but works to Gmail


a guy from another newsgroup post said my IP is in black list, but how
can i change this now?

take a look at what he said...

-------
Probably they are rejecting your mail because 201.17.185.155 is listed
by sbl-xbl, sorbs, and other DNSBLs. njabl.org shows it as an open
proxy, added to their list on May 21. The next day it was added to
opm.blitzed.org.
--------

joealey2003@yahoo.com
Guest
 
Posts: n/a
#7: Jul 17 '05

re: mail() not working to Y but works to Gmail



1&2. Could not initated the mail object...

How do i initiate it? I think i do not have pear....

3. I used another FROM mail like (other@gmail.com) but i think you are
assuming a reachable IP.
If it is, my IP is valid on the web.

4. Here goes the mailog

//------------------------------------------

Jun 9 11:44:36 MyServerName sendmail[19677]: j59FiajF019677:
from=root, size=103, class=0, nrcpts=1,
msgid=<200506091544.j59FiajF019...@MyServerName.P4 >,
relay=root@localhost
Jun 9 11:44:36 MyServerName sendmail[19679]: warning:
/etc/hosts.allow, line 6: missing newline or line too long
Jun 9 11:44:36 MyServerName sendmail[19679]: j59FiaL8019679:
from=<r...@MyServerName.P4>, size=316, class=0, nrcpts=1,
msgid=<200506091544.j59FiajF019...@MyServerName.P4 >, proto=ESMTP,
daemon=Daemon0, relay=localhost [127.0.0.1]
Jun 9 11:44:36 MyServerName sendmail[19677]: j59FiajF019677:
to=acco...@yahoo.com, ctladdr=root (0/0), delay=00:00:00,
xdelay=00:00:00, mailer=relay, pri=30075, relay=[127.0.0.1]
[127.0.0.1], dsn=2.0.0, stat=Sent (j59FiaL8019679 Message accepted for
delivery)
Jun 9 11:44:39 MyServerName sendmail[19681]: j59FiaL8019679:
to=<acco...@yahoo.com>, ctladdr=<r...@MyServerName.P4> (0/0),
delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=30288,
relay=mx4.mail.yahoo.com. [66.218.86.156], dsn=5.0.0, stat=Service
unavailable
Jun 9 11:44:39 MyServerName sendmail[19681]: j59FiaL8019679:
SYSERR(root): hash map "Alias0": unsafe map file /etc/aliases.db:
Permission denied
Jun 9 11:44:39 MyServerName sendmail[19681]: j59FiaL8019679:
j59FidL8019681: DSN: hash map "Alias0": unsafe map file
/etc/aliases.db: Permission denied
Jun 9 11:44:39 MyServerName sendmail[19681]: j59FidL8019681:
to=<r...@MyServerName.P4>, delay=00:00:00, xdelay=00:00:00,
mailer=local, pri=31340, dsn=2.0.0, stat=Sent

5. You mean my host must be a internic registered host name? Oh my
god, it ued to... i'm gona make it.

Gordon Burditt
Guest
 
Posts: n/a
#8: Jul 17 '05

re: mail() not working to Y but works to Gmail


>I can't speak for Yahoo for I've never used their mail, but some hosts just[color=blue]
>reject all mail from servers that do not meet certain (often secret)
>conditions:
>
>* IP is not blacklisted.
>* Reverse DNS lookup does not resolve to hostname.
>* Messages do not include certain words.
>* Attachment are not of given type (I know servers that reject ZIP files).[/color]

There are more conditions than this to worry about. For example,
mail may be rejected :

- The server identified by the From: address (MX records on the domain)
is localhost, 127.0.0.1, a private address, or doesn't exist.
- The server identified by the From: address does not accept any bounce
messages. ( MAIL FROM:<> to the SMTP server always fails, either
immediately or after RCPT TO:).
- The server identified by the From: address will not accept the address
in the From: line as a recipient (Exim callout verify).
- The mail contains an attachment (ANY attachment). This is fairly
unusual, though.
- The mail contains an attachment of apparent executable type
(exe, com, pif, scr).
- The domain identified by the From: address publishes SPF records and
the mail sender isn't listed.
- The domain identified by the From: address is on a list of known
or suspected banks (especially banks being phished) and it fails
to publish SPF records.
- Any domain in the headers (To:, Cc:, Reply-to:, From:) ends in a
period, contains two consecutive periods, or is "<Undisclosed Recipients:;>",
even if the offending domain is not a sender or recipient of this
copy of the message.

Gordon L. Burditt
ECRIA Public Mail Buffer
Guest
 
Posts: n/a
#9: Jul 17 '05

re: mail() not working to Y but works to Gmail


The most common problem people have with the mail() function is the failure
to include both the envelope from address and the from address in the call.
This commonly results in failed delivery due to spam filtering at the
receiving end. The solution: set your header-from address, or use this
function:

<?
function MAIL_NVLP($fromname, $fromaddress, $toname, $toaddress, $subject,
$message)
{
// copyright © 2005 ECRIA LLC, http://www.ECRIA.com
// This code is free to use and modify as long as this notice remains
unchanged.
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$fromname."\" <".$fromaddress.">\n";
return mail($toaddress, $subject, $message, $headers);
}
?>

ECRIA
http://www.ecria.com


NC
Guest
 
Posts: n/a
#10: Jul 17 '05

re: mail() not working to Y but works to Gmail


joealey2003@yahoo.com wrote:[color=blue]
>
> a guy from another newsgroup post said my IP is in black list,
> but how can i change this now?[/color]

Secure your SMTP server. If you are not managing it yourself,
ask your provider to do so. If they refuse, there's nothing
you can do.

Cheers,
NC

Closed Thread


Similar PHP bytes