is anybody know any solution for below problem
in my project, i am send email to client using smtp and php mailer and gmail script. so when i am send mail gmail send mail to particular client. for that i am passing gmail login and user name which is valid. all mail are sending properly. but sometime it may happen that some client not receive mail and at that time i am not able to get or trace any error. so i there any way, when i am sending mail to client , and when client get it and read it at that time i got any kind of confirmation.
Please if anybody have any idea , help me out.
to check if it is sending mail as intended; <? php $email = "[email protected]"; $subject = "Email Test"; $message = "this is a mail testing email function on server"; $sendMail = mail($email, $subject, $message); if($sendMail) { echo "Email Sent Successfully"; } else { echo "Mail Failed"; } ?>
PHPMailer is the classic email sending library for PHP. It supports several ways of sending email messages such as mail(), Sendmail, qmail, and direct dispatch to SMTP servers. In addition, it provides a list of advanced features: SMTP authentication.
PHPMailer is a code library and used to send emails safely and easily via PHP code from a web server. Sending emails directly via PHP code requires a high-level familiarity to SMTP standard protocol and related issues and vulnerabilities about Email injection for spamming.
usually this happens because the sending server is already marked as spam by somebody. The way i found is go to the gmail account mark the item as 'important' in gmail and 'Add to Safe senders' in Outlook. Show activity on this post. if this is your full codes then you have to write the path of the PHPMailer thats it.
<?php
/**
* Simple example script using PHPMailer with exceptions enabled
* @package phpmailer
* @version $Id$
*/
require ('../class.phpmailer.php');
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$body = "Please return read receipt to me.";
$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
$mail->Host = "SMTP SERVER IP/DOMAIN"; // SMTP server
$mail->Username = "EMAIL USER ACCOUNT"; // SMTP server username
$mail->Password = "EMAIL USER PASSWORD"; // SMTP server password
$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("[email protected]","SOMEONE");
$mail->From = "[email protected]";
$mail->FromName = "SOMEONE";
$to = "[email protected]";
$mail->AddAddress($to);
$mail->Subject = "First PHPMailer Message[Test Read Receipt]";
$mail->ConfirmReadingTo = "[email protected]"; //this is the command to request for read receipt. The read receipt email will send to the email address.
$mail->AltBody = "Please return read receipt to me."; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
echo 'Message has been sent.';
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
?>
Some modification need to be done in above script.
Configure SMTP mail server.
Set the correct FROM & FROM Name ([email protected], SOMEONE)
Set the correct TO address
from
also
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With