Birthday

Nothing special happened but yesterday is my anniversary. The notice above came when I opened my mailbox on Sunday morning in office & it tried to prove that the message is the first “mouth” which saying happy birthday words to me. Yup, I was designated that way to created the small happiness to the members who joining the corporate website. Also, as well as supporting the Customer Relationship Management on it.

The concept was clearly simple. Every 01.00 AM, there is a script executed by a crond daemon (crontab) on the web server which running a search & querying thousands of members which having birthday on the current date. If they are exist, one by one member are sent the email script generated by the add in custom made module integrated to the website.

0 1 * * * /usr/bin/php –f /var/www/html/your_script.php


On a web server running an SMTP server integrated to the same machine, there will be no problem at all. But, what about if they had separated on each different machine & location? Well, actually the systems are also the same. The thing you have to ware is the availability of the incoming connection by the mail server from external IP address especially from the web server. For this, you can setting up the mail server option.

Look at the sample script below how to create this similar automated email notice:

#!/usr/bin/php
IsSMTP(); // telling the class to use SMTP
$mail->Host = "your.smtp.host "; // SMTP server
$mail->From = "your.account@web.server";
$mail->FromName = "Your Name Here";
$mail->IsHTML(true);
$mail->SetLanguage("en", "../lib");
$mail->AddAddress($email);
$mail->Subject = $subject;
$mail->Body = $pesan;
$mail->WordWrap = 50;

if(!$mail->Send())
{
echo("Server email down. [" . $mail->ErrorInfo . "]");
}
else
{
echo("[$hr_ini] >> Permintaan account telah dikirim ke alamat $email.\n\n");
}
$mail->ClearAddresses();
$mail->ClearAttachments();

?>


It is not so difficult to setting up it with PHPMailer, like to I used always before.

Labels:


PS: If you've benefit from this blog,
you can support it by making a small contribution.

Enter your email address to receive feed update from this blog:

Post a Comment

 

Post a Comment

Leave comments here...