Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
Old 06-01-2010, 03:58 AM PHP
Junior Talker

Posts: 2
Name: contus
Trades: 0
How to check whether the mail has been successfully send using mail function in php?

Please any one tell me .....thanks
php programmer is offline
View Public Profile Visit php programmer's homepage!
 
 
Register now for full access!
Old 06-01-2010, 04:04 AM Re: PHP
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
PHP Code:
if(mail($recipient$subject$body$headers)){
//Mail sent
}
else
{
//Mail failed

Phunk Rabbit is offline
View Public Profile Visit Phunk Rabbit's homepage!
 
Old 06-01-2010, 06:20 AM Re: PHP
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
or you can send a mail to your self and physically check your in-box.

You cant really verify if the person has received it after the mail function has been called successfully
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
View Public Profile
 
Old 06-01-2010, 08:40 PM Re: PHP
Marik's Avatar
Skilled Talker

Posts: 99
Trades: 0
The above 2 posters gave you 50 and 50 percent of the answer. But just to reiterate:

1. You can use an if statement to check if the mail function has been successfully executed.

2. There is probably no way to check if the email has actually reached it's intended destination. For example, perhaps the mail function was properly executed on your server but the email server it was intended for is currently down hence the email was never sent. Once it leaves your server the only way to track it (that I cab think of) would be through some type of user action like a link with an anchor text of "Click me to confirm you have received this message (or something)" and when clicked this will go to a page on your site and the script on that page will grab the GET parameter to confirm that one more email was received. Of course the downside of such method is you would have to rely on people actually clicking that link to let you know that they have received the mail which they may or may not do.

And of course if you just want to see if the script is working you can just do the obvious and send yourself an email.
Marik is offline
View Public Profile
 
Old 06-03-2010, 02:44 PM Re: PHP
spawn's Avatar
Junior Talker

Posts: 3
Name: Sve
Location: Bulgaria
Trades: 0
Actually you are almost right.
But there is no need to add feedback which user must click to inform you that your email is received. Exist another method to do this secretly. Call it "tracking emails for read". It is done as follows, you send someone a HTML email. In the HTML you have an image tag looking like so
HTML Code:
<img src="http://domain.com/mysite.php?email=address@domain.com"  width=1 height=1>
Now what happens is that when they open the email it will call the PHP script thinking its an image. Since you have the address in the image tag you know what address it was that opened the email.

Now for your php script, you just use the email address for whatever you want to do, eg look up in a database and then set a column to true to note that they opened the email. After you have done that use the readfile() function to open a small image on the server and pass it to the email client. That way the email program is getting image data, what it expected since thats what it requested.
__________________
Nothing is imposible, imagination is everything!

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Last edited by spawn; 06-03-2010 at 02:45 PM..
spawn is offline
View Public Profile
 
Old 06-04-2010, 02:59 PM Re: PHP
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Spawn's idea is a good method used by email marketing campaign tracking, and allows for automatically collecting data for opened emails.

Another method you can use is to pass an email header for disposition notification, but only email clients that supports it and has it enabled.

Disposition-Notification-To: <email@domain.com>
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
View Public Profile
 
Closed Thread     « Reply to PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28480 seconds with 12 queries