473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

checking messages sent with mail()

I use the following code to send e-mails with PHP:

if(@mail(....))
{
//Send OK
} else {
//Send Bad
}

But how can I verify that a message was really sent (in case of "Sent
OK)?
I mean, mail() "returns TRUE if the mail was successfully accepted
for delivery", but this is not a guarantee that the message left the
server (i.e. was sent).
How can I check that?
Of course I already tried to send e.mailto my.self and works but how
can I check any exception or error?

Thank you very much for your reply.
Gio
Jul 17 '05 #1
4 2218
"Giobibo" <gi*****@yahoo.com> wrote in message
news:ms********************************@4ax.com...
I use the following code to send e-mails with PHP:

if(@mail(....))
{
//Send OK
} else {
//Send Bad
}

But how can I verify that a message was really sent (in case of "Sent
OK)?
I mean, mail() "returns TRUE if the mail was successfully accepted
for delivery", but this is not a guarantee that the message left the
server (i.e. was sent).
How can I check that?
Of course I already tried to send e.mailto my.self and works but how
can I check any exception or error?

Thank you very much for your reply.
Gio

Specify a return path, and check the return account, either by pop'ing the
box or by having a script filter any email to that account.

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #2
On Wed, 17 Mar 2004 09:17:32 GMT, "CountScubula"
<me@scantek.hotmail.com> wrote:

Specify a return path, and check the return account, either by pop'ing the
box or by having a script filter any email to that account.


Thank you very much for your reply.

Please could you give more details, I do not understand what does
mean:

"pop'ing the box" or "a script filter any email to that account"

Thanks again
Gio

Jul 17 '05 #3
There is no convinient way to check reception, unless you are able
to check recipient account, what has been suggested in one of the
answers.

There is one thing that you can do. mail() function connects to uotgoing
server and expects it to deliver the message. Perhaps you can find a way
to ensure that message issent without queing, which is, I belive,
possible with sendmail, and some other mail servers on UNIX systems, or you
can open use sockets to:

- query DNS to determine the mail host for recipients domain
- send message via SMTP

I think that sendmail ha switches for sending message without queue-ing,
and you should pipe the message to standard input of sendmail process.
I don't know right now what the command switches are, you will have to
check sendmail documentation.

--
Ask yourself: are you ready for the enterprise ?
Jul 17 '05 #4
"Giobibo" <gi*****@yahoo.com> wrote in message
news:57********************************@4ax.com...
On Wed, 17 Mar 2004 09:17:32 GMT, "CountScubula"
<me@scantek.hotmail.com> wrote:

Specify a return path, and check the return account, either by pop'ing thebox or by having a script filter any email to that account.


Thank you very much for your reply.

Please could you give more details, I do not understand what does
mean:

"pop'ing the box" or "a script filter any email to that account"

Thanks again
Gio


Ok, when you use the mail() command, php is not sending the mail, but rather
passing it to the local mailer. (i am assuming sendmail/linux)

If the email can not be deliverd, it is sent back to the Return-path:
email@address , this can be your valid email address, and you will get all
the email that can not be sent. or you can also do these things:

1) Have the email address have its own email box, and you can pop it, by
this I mean, you can log in and check it with a mail client or a php script.

2) when the email arrives to this email adress, have sendmail pass it to a
php script, and have that script look it over and see why it came back.

I have sent up a AOL mailing listserver, for a client, and all the mail that
bounces back goes into a server, and that server checks why it was not
deliverd, if it was becouse the user doesnt exist, then it removes them from
the database, if there mailbox was full, it tries to redeliver at another
time. and so on....
As someone pointed out you can try a direct deliver, I have written a
framework for this, it is really simple to use, and you will know if the
mail was sent, and if not, you will have a good indication of why.

http://www.gzentools.com/snippetview...l&v=mxmail.php
--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Damien | last post by:
Hello to all, I've written a script that take quite a long time to execute (email sending). Last time I ran it, PHP gave me a "execution time limit exceeded" (or something like that), so I changed...
5
by: Dylan Parry | last post by:
Hi, I am by no means a Python programmer, but I am dabbling with it and trying to create a simple program that reports how many emails I have to download. So far, using the poplib extension, I...
3
by: Yorn Ziesche | last post by:
Hi everybody, i try to send messages longer than 7990 characters from a text field in SSQL2000. Unfortunatly the messages get cut off after 7990 character. I did everything which is described...
3
by: Riku Kosonen | last post by:
Hi, We have some problems with sending mail with the SMTP service on IIS (Windows 2000). We use the ASP.NET platform and have an ASPX-page that sends different mail messages to about 1000...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
0
by: yash518 | last post by:
Hi friends, I am using the AJAX to call a method on the server which sends a mail to the user. I am using struts' action class to send the mail. After sending process complete I am saving action...
1
by: halcyon943 | last post by:
have 4 folders that I watch and need to move files from to another location. Three constraints: -Finish time. Make sure the program stops transferring files at a specific time -Number of...
18
by: Grant Edwards | last post by:
Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages?...
0
by: skip | last post by:
RonI think most of us are annoyed by the recent SPAM messages that Roncrept onto our list. I'd like to suggest a possible solution, and Ronmaybe start a thread that eventually will rid us of this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.