PHP Mailer code

  $result = "";

$mailboddy='Name: '.$usr_name.'<br/>';

$mailboddy.='Email: '.$usr_email.'<br/>';

$mailboddy.='Phone: '.$usr_phone.'<br/>';

$mailboddy.='Script Length: '.$script_length.'<br/>';

$mailboddy.='Usage: '.$use.'<br/>';


require get_template_directory() . '/classes/class.phpmailer.php';

$phpmailer = new PHPMailer;

$phpmailer->IsSMTP(); //Sets Mailer to send message using SMTP

$phpmailer->Host = 'smtp.gmail.com'; //Sets the SMTP hosts of your Email hosting, this for Godaddy

$phpmailer->Port = '465'; //Sets the default SMTP server port

$phpmailer->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables

$phpmailer->Username = 'pradeep.webiwit@gmail.com'; //Sets SMTP username

$phpmailer->Password = 'vzateptmuvzhoidt'; //Sets SMTP password

$phpmailer->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls"

$phpmailer->From = $usr_email; //Sets the From email address for the message

$phpmailer->FromName = $usr_name; //Sets the From name of the message

$phpmailer->AddAddress('navototest@gmail.com'); //Adds a "To" address

if(isset($sfile) && !empty($sfile)){

//$phpmailer->addAttachment($attachment,$attachment_name);

$phpmailer->addAttachment($_FILES["file"]["tmp_name"],$sfile);

}

//$mail->AddCC($_POST["email"], $_POST["name"]); //Adds a "Cc" address

$phpmailer->WordWrap = 50; //Sets word wrapping on the body of the message to a given number of characters

$phpmailer->IsHTML(true); //Sets message type to HTML

$phpmailer->Subject = 'Request for Script'; //Sets the Subject of the message

$phpmailer->Body = $mailboddy; //An HTML or plain text message body

if($phpmailer->Send())

{

$result = 'success';

}

else

{

$result = 'failed';

}

echo $result;

}else{

   echo "failed";

}

wp_die();

Comments

Popular posts from this blog

Add Css And Js Files on Specific Page In laravel

Xpendy Pending

Laravel Join with two coloums