Re: Re: verification of mail success

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

 



Hello,

on 02/23/2006 10:52 PM Mattias Thorslund said the following:
>>> This might be "too simple" or not...
>>>
>>> I'm trying to send emails from my PHP page, and while both mail() and PEAR Mail
>>> work, I'm having a hard time finding out whether a message was actually sent or
>>> not.
>>>
>>> With both mail() and PEAR Mail, an email to an invalid domain (syntactically
>>> valid) name returned "success"... Running mailq at the command prompt gives me:
>>>
>>> "(Host or domain name not found. Name service error for name=activeagenda.org
>>> type=MX: Host not found, try again)"
>>>
>>> Basically, I'd like my PHP script to know of issues like these.
>>>     
>> What you want is impossible most of the time. The problem is that
>> usually applications are MUA (Mail User Agents) and so do not deliver
>> messages. They rather queue them in the MTA (Mail Transfer Agent) queue.
>> So you only know whether the message was successfully deliver or not if
>> you request some kind of delivery notification.
>>
>> Alternatively, if you want to know whether an address is valid, you may
>> want to try this e-mail validation class.
>>
>> http://www.phpclasses.org/emailvalidation
>>
>> You may also want to try this other class that can act partially as an
>> MTA. It is a normal mail composing and sending class with a SMTP
>> delivery sub-class that has a direct delivery mode. This means that it
>> will attempt to send the message directly to the destination SMTP server
>> rather than queueing in the local MTA queue.
>>
>> It comes with a wrapper function named urgent_mail(). It is compatible
>> with the mail function, except that it uses the class direct delivery
>> mode to attempt to deliver the message right away. If it fails due to
>> some temporary error, it falls back to the mail() function.
>>
>> http://www.phpclasses.org/mimemessage
>>   
> 
> First, thanks for quick replies, everyone!
> 
> Manuel: I'll look into the mimemessage class.
> 
> Yes I'm aware of the mail queue. I guess what I'm after is way to get a
> more detailed status message. I notice that in the mail queue, each
> message is given a unique ID, which I suspect could be used for my
> purpose, i.e. has the message been processed yet, is there a temporary
> or permanent delivery problem, etc. I don't see how the PHP function
> would be able to get the message ID of the message it just handed over
> to the MTA.

It is the Message-ID: header. Just set it to your unique identifier for
tracking purposes.


> I guess one way would be to implement a queue of my own, and use the
> "direct SMTP" approach to deliver messages.

It may be a way to go, but keep in mind that the temporary failure rates
are increasing due to the number of SMTP servers that use grey listing.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux