Posts

Showing posts with the label SytaxHighlighter

How to send emails using PHPmailer and GMAIL SMTP

Image
Here I have tried how to send PHPMailer with attachement using SMTP configuration. For SMTP Configuration we here used GMAIL Auth. You can used any Auth like SMTP2GO , SendGrid . Download PHPMailer library. PHPMailer Sample Code Addd or Copy paste the following code in your editor and save with any filename with extension ".php" and try in your live server or local server. But Make sure you have to connect with internet with proper Auth details <?php require_once('phpmailer/PHPMailerAutoload.php'); $mail = new PHPMailer(); $mail->CharSet = "utf-8"; $mail->IsSMTP(); // Set mailer to use SMTP $mail->SMTPDebug = 1; // Enable verbose debug output $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = "xxx@example.com"; //Your Auth Email ID $mail->Password = "xxxxxx"; //Your Password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Host = "