public function action_email()
{
//Download this PHPMailer module from https://github.com/PHPMailer/PHPMailer
// mail send process start
require DOCROOT."modules/PHPMailer/PHPMailerAutoload.php";
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'dilir.me'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'info@dilir.me'; // SMTP username
$mail->Password = '***'; // SMTP password
$mail->SMTPSecure = ''; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->setFrom('info@dilir.me', 'Mailer');
$mail->addAddress('dilir.khan@gmail.com', 'Dilir'); // Add a recipient
$mail->addReplyTo(dilir.khan@gmail.com', 'Dilir');
$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
$mail->addAttachment(DOCROOT . 'documents/title.pdf'); // Add attachments
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'PHP Mailer Implementation';
$mail->Body = 'Yes, I was able to send email using PHPMailer again. Check attachment.';
$mail->AltBody = 'Yes, I was able to send email using PHPMailer again. Check attachment.';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent. Check attachment.';
}
// mail sent process end
}
{
//Download this PHPMailer module from https://github.com/PHPMailer/PHPMailer
// mail send process start
require DOCROOT."modules/PHPMailer/PHPMailerAutoload.php";
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'dilir.me'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'info@dilir.me'; // SMTP username
$mail->Password = '***'; // SMTP password
$mail->SMTPSecure = ''; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->setFrom('info@dilir.me', 'Mailer');
$mail->addAddress('dilir.khan@gmail.com', 'Dilir'); // Add a recipient
$mail->addReplyTo(dilir.khan@gmail.com', 'Dilir');
$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
$mail->addAttachment(DOCROOT . 'documents/title.pdf'); // Add attachments
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'PHP Mailer Implementation';
$mail->Body = 'Yes, I was able to send email using PHPMailer again. Check attachment.';
$mail->AltBody = 'Yes, I was able to send email using PHPMailer again. Check attachment.';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent. Check attachment.';
}
// mail sent process end
}
No comments:
Post a Comment