Connecting Tech Pros Worldwide Help | Site Map

mail with pear... i don't understand...

L'astemio
Guest
 
Posts: n/a
#1: Jul 17 '05

hi all

i must send a mail from a php form. ok. i have pear installed. ok.

this is my code:

<?
include("Mail.php");
$recipients = "info@domain.com";
$headers["To"] = "info@domain.com";
$params["host"] = "mail.domain.com";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "account@domain.com";
$params["password"] = "password";
$headers["Subject"] = "Test Mail";

$mail_body = "\r\n";
$mail_body .= "-----------------------------\r\n";
$mail_body .= "TEST MAIL TEST MAIL TEST MAIL\r\n";
$mail_body .= "-----------------------------\r\n";
$mail_body .= "\r\n";

$headers["From"] = "John Doe <account@domain.com>";
$mail_object =& Mail::factory("smtp", $params);
$mail_object->send($recipients, $headers, $mail_body);
}
?>

the thing I can't understand is: i try to make this code connect to
mailserver A (mail.domain.com), with authentication, and all is ok. no, not
all: I write to 2 differents address (by changing the parameters in the
code) and an address receives mail, the other one doesn't receive any mail.
I try to use the same server by using my standard mail client, and I can
reach both address. first thing I don't understand. someone can tell me
what's happening? :-)

the second thing is that if I try to use another mailserver
(mail.otherdomain.com) the script doesn't run at all. I try to strip away
the auth code, but nothing. maybe the server must have some option
enabled/disabled to be reachable by php/pear?

thanx in advance
d.

--
La bella che guarda il fiume ha un nome che fa paura...
La bella che è addormentata ha un nome che fa paura:
Libertà! Libertà! Libertà!
NC
Guest
 
Posts: n/a
#2: Jul 17 '05

re: mail with pear... i don't understand...


L'astemio wrote:[color=blue]
>
> i try to make this code connect to mailserver A (mail.domain.com),
> with authentication, and all is ok. no, not all: I write to 2
> differents address (by changing the parameters in the code) and
> an address receives mail, the other one doesn't receive any mail.
> I try to use the same server by using my standard mail client,
> and I can reach both address. first thing I don't understand.
> someone can tell me what's happening? :-)[/color]

Most likely, the second server filters PHP-generated messages out
based on something it reads in the message headers. Compare the
headers of PHP-generated message with those of the message sent
with a standard client program; this may give you some clues.
[color=blue]
> the second thing is that if I try to use another mailserver
> (mail.otherdomain.com) the script doesn't run at all.[/color]

Are any error messages displayed?

Cheers,
NC

Closed Thread