confirm mail send using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
srdva59
Forum Commoner
Posts: 77
Joined: Sun Feb 15, 2009 10:58 am

confirm mail send using php

Post by srdva59 »

hi,
there is any way to confirm is the mail was sent and received and read by using
a php script?
when we send by the outlook we have that option but i want
add that function to my script that is possible in php?
thanks for your help
:)
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: confirm mail send using php

Post by JAB Creations »

You send mail by doing the following...

Code: Select all

<?php
mail('caffeinated@example.com', 'My Subject', $message);
?>
...so just assigned that to a variable and check for true or false...

Code: Select all

<?php
$result = mail('caffeinated@example.com', 'My Subject', $message);
 
if (!result) {echo '<div><p>Mail was not able to be sent!</p></div>';}
else {echo '<div><p>Mail was sent!</p></div>';}
?>
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: confirm mail send using php

Post by watson516 »

That will only check to see if the message was sent successfully, not if it was read by the user. If its html email, you could use an image from your site with some get variables to see when the users reads the email. Im not sure if this is the 'proper' way of doing things but Im sure it would work. There could be other ways.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: confirm mail send using php

Post by JAB Creations »

I think there is some sort of request receipt feature I've encountered before...I'm not sure how widely it's supported though. That's the only lead I'd have as far as seeing if email was checked on a different domain.
srdva59
Forum Commoner
Posts: 77
Joined: Sun Feb 15, 2009 10:58 am

Re: confirm mail send using php

Post by srdva59 »

nice thanks for you help :)
Post Reply