email sended, but not received

I write the following code for a test:

#######################################
<?php
$mail_from = "[omissis]";
$mail_to = $_GET["email"];

$mail_oggetto = "Test";
$mail_corpo = "This is a test";

if (mail($mail_to, $mail_oggetto, $mail_corpo, "From: $mail_from"))
echo "Email sended to $mail_to";
else
echo "Error: email not sended to $mail_to.";
?>

#######################################

This work fine if $mail_to ends with hotmail.com or gmail.com, but if it
ends with tiscali.it, email.it or inwind.it the email results sended,
but I don't receive it!

I think that some provider reject my email, because if this code was
wrong, no message must be received.

As can I resolve it? If I must send a message with programs as Outlook
or Thunderbird, I must use as sender an email of my provider, but in
this case Apache (apache [at] localhost.localdomain) result the senders.
Marco [ Mi, 31 Januar 2007 19:07 ] [ ID #1614402 ]

Re: email sended, but not received

Marco wrote:
> I write the following code for a test:
>
> #######################################
> <?php
> $mail_from = "[omissis]";
> $mail_to = $_GET["email"];
>
> $mail_oggetto = "Test";
> $mail_corpo = "This is a test";
>
> if (mail($mail_to, $mail_oggetto, $mail_corpo, "From: $mail_from"))
> echo "Email sended to $mail_to";
> else
> echo "Error: email not sended to $mail_to.";
> ?>
>
> #######################################
>
> This work fine if $mail_to ends with hotmail.com or gmail.com, but if it
> ends with tiscali.it, email.it or inwind.it the email results sended,
> but I don't receive it!

Thats the receiving mail server that filters away the mail based on the host
in the from-address. tiscali.it is also a quite popular domain for spemmers to
send their spam from.


> As can I resolve it? If I must send a message with programs as Outlook
> or Thunderbird, I must use as sender an email of my provider, but in
> this case Apache (apache [at] localhost.localdomain) result the senders.

Use a reply-to header where you use those spammer host addresses.

--

//Aho
Shion [ Mi, 31 Januar 2007 20:34 ] [ ID #1614403 ]

Re: email sended, but not received

> Use a reply-to header
I try it, but it is the same.
I think that the problem is the Return-Path in header, that must be my
email addres with my provider (myuserid [at] tiscali.it), while is set to
apache [at] localhost.localdomain. The Received line is set to "from
localhost.localdomain (localhost.localdomain [127.0.0.1]) by
localhost.localdomain", instead of "from smtp.tiscali.it (84.220.17.211)
by ecc.".
Marco [ Mi, 31 Januar 2007 22:50 ] [ ID #1614405 ]

Re: email sended, but not received

Like Aho said, your emails are being considered harmful to mail server
from these domains, to prevent this behavior you must send more
headers than From!

I advise you to use Phpmailer class, that has all this stuff
implemented and ready to use

http://phpmailer.sourceforge.net/

Jose Silva
Jose da Silva [ Mi, 31 Januar 2007 23:11 ] [ ID #1614406 ]

Re: email sended, but not received

Jose da Silva ha scritto:
> Like Aho said, your emails are being considered harmful to mail server
> from these domains, to prevent this behavior you must send more
> headers than From!

I tried to add headers, but emails are not received too. I think that
the problem il only the Return-Path, that I can't modify, because I
think is a setting of sendmail program, and I don't know how modify it.

I want send email with my provider (myuser [at] tiscali.it), not with a local
(in my PC) smtp server.

N.B. I download Phpmailer, but I don't understand how it work. If it
only addheaders, I alreay try this, and I think is not the problem.


Thank you for your help.

Marco
Marco [ Do, 01 Februar 2007 00:51 ] [ ID #1614408 ]

Re: email sended, but not received

Are you inserting a existent and valid email address, on From header?

Sometimes, emails are blocked, cause the email in from header, is not
real.

Jose Silva
http://www.t6m.com

On Jan 31, 11:51 pm, Marco <nos... [at] excite.it> wrote:
> Jose da Silva ha scritto:
>
> > Like Aho said, your emails are being considered harmful to mail server
> > from these domains, to prevent this behavior you must send more
> > headers than From!
>
> I tried to add headers, but emails are not received too. I think that
> the problem il only the Return-Path, that I can't modify, because I
> think is a setting of sendmail program, and I don't know how modify it.
>
> I want send email with my provider (myu... [at] tiscali.it), not with a local
> (in my PC) smtp server.
>
> N.B. I download Phpmailer, but I don't understand how it work. If it
> only addheaders, I alreay try this, and I think is not the problem.
>
> Thank you for your help.
>
> Marco
Jose da Silva [ Do, 01 Februar 2007 11:30 ] [ ID #1615611 ]

Re: email sended, but not received

> Are you inserting a existent and valid email address, on From header?
>
Yes, I insert in my full test something as following:

$HEADER="From: Marco<myuser [at] tiscali.it>\n";//I insert here a false
email for avoid spam, but in my test it was the real one.

Now, this is ignored by php, because in headers of the email that I
received (gmail, hotmail) in Italian "Da" [=From] I see
myuser [at] tiscali.it, but in Return-Path there is apache [at] localhost.localdomain.

I tried to add something as $HEADER.="Return-Path:
Marco<myuser [at] tiscali.it>\n";, but it seems be ignored.

Note that if I send email with java program instead of php, in the
Return-Path I see myuser [at] tiscali.it, and I always receive all sended emails.

I have a Fedora 6 (Linux) with Apache that use sendmail program in mail
function, and believe that the problem is as I can set sendmail program
of Linux for insert a proper Return-Path.
Marco [ Do, 01 Februar 2007 11:57 ] [ ID #1615612 ]
PHP » alt.php » email sended, but not received

Vorheriges Thema: How do I limit my number of PHP hits per second?
Nächstes Thema: install and run php, apache and mysql