Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://sourceforge.net/projects/phpmailer/" rel="nofollow">PHPMailer</a> can be <a href="http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/PHPMailer%20v5.1/PHPMailer_v5.1.zip/download" rel="nofollow">downloaded</a> from <a href="http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/PHPMailer%20v5.1/" rel="nofollow">its SourceForge page</a>.</p> <p>Now to the code, which is mostly taken from the examples provided in the ZIPball:</p> <pre><code>&lt;?php require_once 'class.phpmailer.php'; $mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch try { $mail-&gt;AddReplyTo('name@yourdomain.com', 'First Last'); $mail-&gt;AddAddress('whoto@otherdomain.com', 'John Doe'); $mail-&gt;SetFrom('name@yourdomain.com', 'First Last'); $mail-&gt;Subject = 'PHPMailer Test Subject via mail(), advanced'; $mail-&gt;AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically $mail-&gt;MsgHTML(file_get_contents('contents.html')); $mail-&gt;AddAttachment('images/phpmailer.gif'); // attachment $mail-&gt;AddAttachment('images/phpmailer_mini.gif'); // attachment $mail-&gt;Send(); echo "Message Sent OK&lt;/p&gt;\n"; } catch (phpmailerException $e) { echo $e-&gt;errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e-&gt;getMessage(); //Boring error messages from anything else! } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload