Some time when you need to send mail in bulk amount.Then normal mail() function is not working.Because they have a limit to send email every day. You have to use third party script to send email like Amazon etc .Today i am using sending mail using Amazon smtp api .Its a very easy to use in php.Before using this api you have to regirster on Amazon and have to be a username and password of amazon api .Then after download the smtp library PHPmailer from HERE .
After downloading above library and unzip the file there is two main file which we are using -
1-Send_Mail.php
2-index.php
------------------------------------------------------------------------------------------------
Code : Sample code of Send_Mail.php
------------------------------------------------------------------------------------------------
Note: In Send_Mail.php you have to set your own SMTP username and password before using this.
function Send_Mail($to,$subject,$body)
{
require 'class.phpmailer.php';
$from = "salman@futerox.co.in";
$mail = new PHPMailer();
$mail->IsSMTP(true); // SMTP
$mail->SMTPAuth = true; // SMTP authentication
$mail->Mailer = "smtp";
$mail->Host = "tls://email-smtp.us-east.amazonaws.com"; // Amazon SES server, note "tls://" protocol
$mail->Port = 2465; // set the SMTP port according to your server which port is enable on your server
$mail->Username = "AKIAIXMKUPFWCTV77NKQ"; // SMTP username change it with your username
$mail->Password = "Ag5AzgnbrpK/361/+LF1Dq+iCeJEn3s8l3jWQR5zJNNL"; //SMTP password
$mail->SetFrom($from, 'amazon');
$mail->AddReplyTo($from,'amazon');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
if(!$mail->Send())
return false;
else
return true;
}
------------------------------------------------------------------------------------------------
Code : Sample code of index.php
------------------------------------------------------------------------------------------------
//This is the main file from where we are using to test our smtp function.
require 'Send_Mail.php';
$to = "phpsolution@gmail.com";
$subject = "Test Mail Subject";
$body = "Hi<br/>Test Mail<br/>Amazon SES"; // HTML tags
if(Send_Mail($to,$subject,$body)){
echo "maill send successfully";
}else{
echo "some error occoured";
}
If you like this post please don't forgot to notify me to post a comment .
Happy coding guys :)
After downloading above library and unzip the file there is two main file which we are using -
1-Send_Mail.php
2-index.php
------------------------------------------------------------------------------------------------
Code : Sample code of Send_Mail.php
------------------------------------------------------------------------------------------------
Note: In Send_Mail.php you have to set your own SMTP username and password before using this.
function Send_Mail($to,$subject,$body)
{
require 'class.phpmailer.php';
$from = "salman@futerox.co.in";
$mail = new PHPMailer();
$mail->IsSMTP(true); // SMTP
$mail->SMTPAuth = true; // SMTP authentication
$mail->Mailer = "smtp";
$mail->Host = "tls://email-smtp.us-east.amazonaws.com"; // Amazon SES server, note "tls://" protocol
$mail->Port = 2465; // set the SMTP port according to your server which port is enable on your server
$mail->Username = "AKIAIXMKUPFWCTV77NKQ"; // SMTP username change it with your username
$mail->Password = "Ag5AzgnbrpK/361/+LF1Dq+iCeJEn3s8l3jWQR5zJNNL"; //SMTP password
$mail->SetFrom($from, 'amazon');
$mail->AddReplyTo($from,'amazon');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
if(!$mail->Send())
return false;
else
return true;
}
------------------------------------------------------------------------------------------------
Code : Sample code of index.php
------------------------------------------------------------------------------------------------
//This is the main file from where we are using to test our smtp function.
require 'Send_Mail.php';
$to = "phpsolution@gmail.com";
$subject = "Test Mail Subject";
$body = "Hi<br/>Test Mail<br/>Amazon SES"; // HTML tags
if(Send_Mail($to,$subject,$body)){
echo "maill send successfully";
}else{
echo "some error occoured";
}
If you like this post please don't forgot to notify me to post a comment .
Happy coding guys :)