php mailer

<?php
require 'PHPMailerAutoload.php';

$mail = new PHPMailer;

//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = '[email protected]';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]', 'Joe User');     // Add a recipient
$mail->addAddress('[email protected]');               // Name is optional
$mail->addReplyTo('[email protected]', 'Information');
$mail->addCC('[email protected]');
$mail->addBCC('[email protected]');

$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

4.13
8
QVas 110 points

                                    php mailer

4.13 (8 Votes)
0
4
6

                                    composer require phpmailer/phpmailer

4 (6 Votes)
0
4.33
6

                                    &lt;?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';

//Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);

try {
    //Server settings
    $mail-&gt;SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
    $mail-&gt;isSMTP();                                            //Send using SMTP
    $mail-&gt;Host       = 'smtp.example.com';                     //Set the SMTP server to send through
    $mail-&gt;SMTPAuth   = true;                                   //Enable SMTP authentication
    $mail-&gt;Username   = '[email protected]';                     //SMTP username
    $mail-&gt;Password   = 'secret';                               //SMTP password
    $mail-&gt;SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $mail-&gt;Port       = 587;                                    //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

    //Recipients
    $mail-&gt;setFrom('[email protected]', 'Mailer');
    $mail-&gt;addAddress('[email protected]', 'Joe User');     //Add a recipient
    $mail-&gt;addAddress('[email protected]');               //Name is optional
    $mail-&gt;addReplyTo('[email protected]', 'Information');
    $mail-&gt;addCC('[email protected]');
    $mail-&gt;addBCC('[email protected]');

    //Attachments
    $mail-&gt;addAttachment('/var/tmp/file.tar.gz');         //Add attachments
    $mail-&gt;addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name

    //Content
    $mail-&gt;isHTML(true);                                  //Set email format to HTML
    $mail-&gt;Subject = 'Here is the subject';
    $mail-&gt;Body    = 'This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;';
    $mail-&gt;AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail-&gt;send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo &quot;Message could not be sent. Mailer Error: {$mail-&gt;ErrorInfo}&quot;;
}

4.33 (6 Votes)
0
3.88
8
Alphadogg 130 points

                                    &lt;?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';

//Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);

try {
    //Server settings
    $mail-&gt;SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
    $mail-&gt;isSMTP();                                            //Send using SMTP
    $mail-&gt;Host       = 'smtp.example.com';                     //Set the SMTP server to send through
    $mail-&gt;SMTPAuth   = true;                                   //Enable SMTP authentication
    $mail-&gt;Username   = '[email protected]';                     //SMTP username
    $mail-&gt;Password   = 'secret';                               //SMTP password
    $mail-&gt;SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $mail-&gt;Port       = 587;                                    //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

    //Recipients
    $mail-&gt;setFrom('[email protected]', 'Mailer');
    $mail-&gt;addAddress('[email protected]', 'Joe User');     //Add a recipient
    $mail-&gt;addAddress('[email protected]');               //Name is optional
    $mail-&gt;addReplyTo('[email protected]', 'Information');
    $mail-&gt;addCC('[email protected]');
    $mail-&gt;addBCC('[email protected]');

    //Attachments
    $mail-&gt;addAttachment('/var/tmp/file.tar.gz');         //Add attachments
    $mail-&gt;addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name

    //Content
    $mail-&gt;isHTML(true);                                  //Set email format to HTML
    $mail-&gt;Subject = 'Here is the subject';
    $mail-&gt;Body    = 'This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;';
    $mail-&gt;AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail-&gt;send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo &quot;Message could not be sent. Mailer Error: {$mail-&gt;ErrorInfo}&quot;;
}

3.88 (8 Votes)
0
4
7
Moote 110 points

                                    &lt;?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require_once &quot;vendor/autoload.php&quot;;

//PHPMailer Object
$mail = new PHPMailer(true); //Argument true in constructor enables exceptions

//From email address and name
$mail-&gt;From = &quot;[email protected]&quot;;
$mail-&gt;FromName = &quot;Full Name&quot;;

//To address and name
$mail-&gt;addAddress(&quot;[email protected]&quot;, &quot;Recepient Name&quot;);
$mail-&gt;addAddress(&quot;[email protected]&quot;); //Recipient name is optional

//Address to which recipient will reply
$mail-&gt;addReplyTo(&quot;[email protected]&quot;, &quot;Reply&quot;);

//CC and BCC
$mail-&gt;addCC(&quot;[email protected]&quot;);
$mail-&gt;addBCC(&quot;[email protected]&quot;);

//Send HTML or Plain Text email
$mail-&gt;isHTML(true);

$mail-&gt;Subject = &quot;Subject Text&quot;;
$mail-&gt;Body = &quot;&lt;i&gt;Mail body in HTML&lt;/i&gt;&quot;;
$mail-&gt;AltBody = &quot;This is the plain text version of the email content&quot;;

try {
    $mail-&gt;send();
    echo &quot;Message has been sent successfully&quot;;
} catch (Exception $e) {
    echo &quot;Mailer Error: &quot; . $mail-&gt;ErrorInfo;
}

4 (7 Votes)
0
4.43
7
Zaje 110 points

                                    php mailer

4.43 (7 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
mail library php &quot;include mail.php&quot; PHPMailer/PHPMailer/PHPMailer() php mailer working example phpmailer html mail php Emailer send email using phpmailer in php php mail fundtions how does php mailer work php mailjet send email mail method in php use maildev with php mailer php mailer add mail inbox mailer php inbox mailer php web mail in php How ;to use mail function in php php mailer and html how to setup php mailing tutorial mailer php &quot;PHP Mailer&quot; ext:php mail sent using php phpmailer php mailer from php mailer configuration php mailer header mail() php statement php mailer html format how to create mailer with php php mail funciton php mailserver mail to php php declare php mailer library html mail with php what is php mailer php mail at\ email from php mail() function php mail funtion php mailer cls php mailer recieve mails maili in php php mailer config adding mailer in php mail php send emails mail to function in php php mail client inbox php mailer how to send mail using phpmailer in php mail send in php emailing php php mailer similan php mail file php mailer example php send mail php php mail() function php email php mailing function intext:PHP Mailer send email using php mailer php mailer send mail mailbox php mail with builtin php require php mailer php php mailer form phpmailer link email php mailer linkemail mail as html phpmailer how to make mailer with php php mail function example mail from php php mail function how to send email by php mailer php mailer send html php mailer master mail en php php mailer for PHP 5.4 php send mail with phpmailer how to give mail to php mail function php mail en html php mail script mail() in php @mail php php @mail mail html in php php mail example php mail to html mail in php php is mail simple mailer php how send mail in php mail function in php phpmailer mailtrap php mailer llive mail php mail by php simple mail function in php php mailer script html php mailer how to use php mail function php mailjet example php envoyer un mail mail php code mail server php mailserver php phpmailer send email example php mail format mail () in php php mail configuration php mail header php mail versenden class php mailer phpmailer send mailjet php php mail function php mail function use in html mailer code php email.php send mail php mailer php mailere php mail() mail function in php sender name php mail lws how to connect to mailbox php function mail php php mailer php 5.2 php's mail function php mail how it works mailing php php mailer defer mail php mail from address php at mail function send a email using phpmailer mail php function php send mails server/mail.php mail php send php sendmailer how to send email using php mailer php function mail php mail html mailer sending in php php mailer anvoie mail diff&eacute;r&eacute; php mailer ovh phpmailer with php send mail in php php send mail using phpmailer send_mail() in php send_mail in php mail function example in php mail sending in php envoyer mail php php mailer exploit php mail -f php mailer tutorial phpmailer send email phpmailer Mailer php &quot;Mail::send&quot; phpmailer, $mail-&gt;send(); send mail with php mailer can we use php mailer in server mail php app php mailer log phpmailer using mail server mail function php how to send mail in php using phpmailer php mail function syntax mailer code for php working mailer for php send php mail how to mail using php mail in php mail-&gt;header phpmailer php mailer mail send exemple send mail using php mail function mail using phpmailer phpmailer to send mail php mail from mailtrap phpmailer php PHPMailer php mailer add from mail.php php mail code php mail send php mailer to my website php send mail php mailer mailer property php mailer mailer option mailer in php envoyer mails php simple mail in php mail() php include php mailer @mail in php how efficient is php mail() function php mailer class php mail php mail settings phpMailer how to make a mail sender with php how to use php mailer function phpmailer send mail in send email php mailerbr php mailbox portable phpmailer php mailer mail() function php mailer mail() php mailer code github php formular mail senden php tester get php mailer on server get php mailer basic php mailer php mailer core php php mailer with smtp php phpmailer tutorial php smtp library php mailer in core php mailer.php Source.php mailer how to get php mailer username and password php mailer ] how to integrate phpmailer in php phpmailer code to check if mail is not valid phpmailer install composer github PHP Mailer send email without email account on server download phpmailer latest version php mail library example request mail via phpmailer phpmailer mysql approval form github how to send mail using phpmailer phpmailer simple example phpmailer download for php github command smtp email composer mailer php 6.0 smtp email composer php 6.0 send mail by phpmailer phpmailer email system php send mail using phpmailer smtp mailer php requirements setting up php mailer class Mailer phpmailer function phpmailer smtp php phpmailer library for laravel php mailer setup setup phpmailer can phpmailer receive to the host PHPMailer with email sender php mail smtp class phpmailer showing php page php mailer showing php page php mailer in php class phpmailer php 7 mail arguments php php mailer msgXML how to set from address in phpmailer smtp php email code phpmailer object programing lib smtp php how to use html in php mail function phprad send mail github phpmailer github how to run php mailer phpmailer how to use php mailer PHPMailer cc php mailer PHPMailer send email using class.phpmailer.php php send email phpmailer download phpmailer for core php core php mailer send email php server mail server that works well with phpmailer phpmailer send email without subject php smtp email sender how to install phpmailer phpmailer tutorial 2020 html phpmailer phpmailerautoload server envoyer phpmailer html detail fonctuion phpmailer $mail-&gt;Body using phpmailer on webmail example phpmailer master adding php mailer into a php project phpmailer send with api smtp phpmailer php mailer clean mail send phpmailer source code download example php mailer basic usage install phpmailer ubuntu php mailer file phpmailer documentation phpmailer don't send copy class.phpmailer.php download use phpmailer online php phpmailer with composer is html phpmailer website php mail library php mailer set from phpmailer file php mailer to website php include php mailer download php mailer send email from smtp php without library call phpmailer manually php github mailer mail in hostgator php php mailer library php mailer npm how to use phpmailer class download phpmailer library phpmailer function in php phpmailer set smtp credentails send email with php mailer phpmailer if being used send mail php package smtp mail php code download PHPMailer php php send mail composer send email with phpmailer core php phpmaier How can verify mail sender php mailer php mailer download install phpmailer phpmailer example smtp cahge from php mailer php mailer 2020 php mailer in php send email maill php sending smto mail with phpmailer smtp php mailer for core php phpmailer smtp settings in php 7 php mailier include phpmailer phpmailer dependencies phpmailer community phpmailer oop api phpmailer original repo phpmailer library download Class 'PHPMailer\PHPMailer how to send order details using email phpmailer $mail- send( phpmailer format $mail- send() phpmailer format phpmaile() pph mailer php smtp mail mailer download php smtp php phpmailer code phpmailer free to use? php maeler import phpmailer mail.php smtp how to right php inside phpmailer body php mailler phpmailer prerequisites using phpmailer to send mail through php send mail phpmailer php get email composer php send email composer php Mail class phpmailer class send mail with phpmailer phpmailer with smtp php mailer how to send a nice designed email with phpmailer how to send a nice desighned email with phpmailer how to send email using phpmailer in php php mailer code sending email using php mailer phpmailer send smtp phpmailer from php smtp mailer how to put php in phpmailer send email library php email library php phpmailer from email address phpmailer close object example of mail with phpmailer php smtp email include phpmailer 6 in php PHPMailer 6.0.7 removes dot in mailadress PHPMailer.php smtp email php php mainler PHPMailer functions php mailer for you website php mailer in php example mailer/class.phpmailer.php phpmailer tutorial download smtp 3.4 libray for php mailser phpmailer WHERE IS PHP MAILER php email package phpmailer in php phpmailer master phpmailer install how to use php mailer phpmailer setfrom from form entered email mailer php change hostname being used by PHPMailer() how to make secure script for sending links in mail in phpmailer sendmail composer use phpmailer phpmailer php example phpmailer download phpmailer core php code phpmailer smtp core php email class php mailer php script phpmailer library EMAIL PROVIDERS USED TO SEND EMILS IN PHP library smtp php send email phpmailer running phpmailer on an apache server phpmailer file download php phpmailer file download phpmailer smtp mail php php email libraries download phpmailer download phpmailerplugins learn how to use phpmailer php mailer smtp php mail plugin utiliser phpmailer how to send a php code in an email phpmailer example latest php mailer send email with class.phpmailer.php smpt php mails php mailer usage class.phpmailer./ php smtp mail library send mail php using php mailer phpmailer smtp php mailer example phpmailer send mail what is phpmailer phpmailer example in php smtp php mail smtp mail on server phpmailer php email library how to use phpmailer contact email using phpmailer contact email usinfphpmailer php mailer exampe class.phpmailer.php phpmailer download for php php mailer
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source