Posted inProgramming / php

PHPMailer Sending Emails using PHP Code

Today, We want to share with you PHPMailer Sending Emails using PHP Code.In this post we will show you php code to send email using smtp server, hear for Sending Emails in PHP with PHPMailer we will give you demo and example for implement.In this post, we will learn about Sending Emails using PHP with PHPMailer with an example.

PHPMailer Sending Emails using PHP Code

There are the Following The simple About PHPMailer Sending Emails using PHP Code Full Information With Example and source code.

As I will cover this Post with live Working example to develop send mail using phpmailer from localhost, so the send mail using smtp in php example for this example is following below.

php_send_mail
sendMail.php

SMTPDebug = 2;
    $send_mail->isSMTP();
    $send_mail->Host = 'smtp.gmail.com';
    $send_mail->SMTPAuth = true;
    $send_mail->Username = '[email protected]';
    $send_mail->Password = 'set_here_my_password';
    $send_mail->SMTPSecure = 'tls';
    $send_mail->Port = 587;
 
 
    $send_mail->setFrom('sender@yourdomain_name.com', 'Jaydeep');
    $send_mail->addAddress('recipient1@yourdomain_name.net', 'Pakainfo');
    $send_mail->addAddress('recipient2@yourdomain_name.com');
    $send_mail->addReplyTo('noreply@yourdomain_name.com', 'noreply');
    $send_mail->addCC('cc@yourdomain_name.com');
    $send_mail->addBCC('bcc@yourdomain_name.com');
 
    //PHP Files Attachments
    $send_mail->addAttachment('/media/pakainfo_products.tar.gz');
 
    //Content
    $send_mail->isHTML(true); 
    $send_mail->Subject = 'Wel-come To Pakainfo.com & Test Mail Subject!';
    $send_mail->Body    = 'Latest Body of simple Pakainfo is SMTP Email Testing demo';
 
    $send_mail->send();
    echo 'Good Luck Your Message has been sent';
} catch (Exception $e) {
    echo 'Sorry Dear, Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
}

And last You access this web application using any browser like Mozila, chrome or any other with your main domain name following by any script name

http://mydomain_name.com/sendMail.php
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHPMailer Sending Emails using PHP Code.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype