PHPMailer Digest

PHPMailer is a PHP class for PHP that provides a package of functions to send email. The two primary features are sending HTML Email and e-mails with attachments. PHPMailer supports nearly all possiblities to send email: mail(), Sendmail, qmail & direct to SMTP server. You can use any feature of SMTP-based e-mail, multiple recepients via to, CC, BCC, etc. In short: PHPMailer is an efficient way to send e-mail within PHP.

Download Link: http://phpmailer.worxware.com/

============

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();
$mail->IsMail();
$mail->From = "info@from.net";
$mail->FromName = "sender name";
$mail->AddAddress("receiver email");
$mail->AddReplyTo("info@from.net","sender name");
$mail->IsHTML(true);
$mail->CharSet="utf-8";
           $mail->Subject ="Subject"
           $mail->Body = "<p>Hello!</p>";
           if(!$mail->Send()) {
               echo 'Message was not sent.';
               echo 'Mailer error: ' . $mail->ErrorInfo;
           } else {
               echo 'Message has been sent.';
           }
?>

Continue reading “PHPMailer Digest”

PHP Validation Digest

Email:

function is_valid_email($email) {
       $result = TRUE;
       if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)) {
           $result = FALSE;
       }
       return $result;
   }
Moblie:
function is_valid_mobile($mobile) {
    $result = TRUE;
    if(preg_match("/[^0-9]/", $mobile))
    {
        $result = FALSE;
    }
    elseif(strlen($mobile)!=11)
    {
        $result = FALSE;
    }
    elseif(substr($mobile,0,2)!="09")
    {
        $result = FALSE;
    }

    return $result;
}