Re: Emailing via mail(), secondary servers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Manuel Lemos wrote:

Hello,

On 02/11/2004 09:13 AM, Paul J. Smith wrote:

At the moment you only seem able to send mail via a specific host
specified in the ini file.    I want some resilience so I can send
emails even if the first mail server cannot accept email.

Problem 1
As far as I know mail() returns no result so you cannot tell if your
first attempt to mail something was OK or not.


PHP returns a result yes but that means whether the relay SMTP server accepted the message for later delivery. It can't tell immediately if the message could be delivered to the final recepient unless the final SMTP server is the same.

Still, you need to be aware that some servers are configured to ignore messages that will never be delivered. Most servers will bounce the message but often not imediately. Usually the messages go to local queue before they are attempted to deliver to the final mailbox. This has been particularly true with servers with anti-virus that can't handle the flood of infected messages so fast.

The best you can do is to set a return path address so the message gets bounced soon or later in case there was a problem.



Problem 2
You can't override the relaying server ip in the mail() function.


Not on Windows with normal SMTP servers. On Unix/Linux using sendmail, the messages are not queued using SMTP. That is too slow and pointless when the sendmail is installed in the same machine where you are sending messages from.


Has anyone dealt with this?  Any suggestions before I try and botch my
own solution?


I would suggest dumping Windows and use a Unix/Linux solution with sendmail or compatible program like qmail, postfix, etc...

If you are stuck with Windows, you may want to try this SMTP class that les you send messages directly to the receipient SMTP server, thus without relaying in any intermediate SMTP server.

http://www.phpclasses.org/smtpclass

If you do not want to change your scripts much, you may also want to use this other class that uses the class above to send message via SMTP. It comes with a wrapper function named smtp_mail() that is compatible with the mail() function but lets you configure SMTP delivery details like direct delivery option.

http://www.phpclasses.org/mimemessage



You could also try PEAR's Mail package. http://pear.php.net/package/Mail

--
--
paperCrane <Justin Patrin>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux