]> git.mxchange.org Git - hub.git/blobdiff - inc/classes/third_party/php_mailer/examples/index.html
Code syncronized with shipsimu code base
[hub.git] / inc / classes / third_party / php_mailer / examples / index.html
diff --git a/inc/classes/third_party/php_mailer/examples/index.html b/inc/classes/third_party/php_mailer/examples/index.html
new file mode 100644 (file)
index 0000000..d0a8b9d
--- /dev/null
@@ -0,0 +1,73 @@
+<p>The example file &quot;test_mail.php&quot; contents include:</p>\r
+<div style="width: 600px; background-color: #CCCCCC;">\r
+<code>\r
+&lt;?php<br>\r
+<br>\r
+include_once('../class.phpmailer.php');<br>\r
+<br>\r
+$mail    = new PHPMailer();<br>\r
+<br>\r
+$body    = $mail->getFile('contents.html');<br>\r
+<br>\r
+$body    = eregi_replace("[\]",'',$body);<br>\r
+$subject = eregi_replace("[\]",'',$subject);<br>\r
+<br>\r
+$mail->From     = "name@yourdomain.com";<br>\r
+$mail->FromName = "First Last";<br>\r
+<br>\r
+$mail->Subject = "PHPMailer Test Subject";<br>\r
+<br>\r
+$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test<br>\r
+<br>\r
+$mail->MsgHTML($body);<br>\r
+<br>\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");<br>\r
+<br>\r
+if(!$mail->Send()) {<br>\r
+  echo 'Failed to send mail';<br>\r
+} else {<br>\r
+  echo 'Mail sent';<br>\r
+}<br>\r
+<br>\r
+?&gt;\r
+</code>\r
+</div>\r
+<br>\r
+Although you could use full compabitility with PHPMailer 1.7.3, this example\r
+shows how to use the new features. If you view 'contents.html', you will note\r
+that there is a background image used in the &lt;body tag as well as an image used\r
+with a regular &lt;img tag. Here&#39;s what the HTML file looks like:<br>\r
+<br>\r
+<div style="width: 600px; background-color: #CCCCCC;">\r
+<code>\r
+&lt;body background="images/bkgrnd.gif" style="margin: 0px;"&gt;<br>\r
+&lt;div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"&gt;<br>\r
+&lt;div align="center"&gt;&lt;img src="images/phpmailer.gif" style="height: 90px; width: 340px"&gt;&lt;/div&gt;&lt;br&gt;<br>\r
+&lt;br&gt;<br>\r
+&nbsp;This is a test of PHPMailer v2.0.0 rc1.&lt;br&gt;<br>\r
+&lt;br&gt;<br>\r
+This particular example uses &lt;strong&gt;HTML&lt;/strong&gt;, with a &lt;div&gt; tag and inline&lt;br&gt;<br>\r
+styles.&lt;br&gt;<br>\r
+&lt;br&gt;<br>\r
+Also note the use of the PHPMailer at the top with no specific code to handle<br>\r
+including it in the body of the email.&lt;/div&gt;<br>\r
+&lt;/body&gt;<br>\r
+</code>\r
+</div>\r
+<br>\r
+A few things to notice in the PHP script that generates the email:\r
+<ul>\r
+  <li>the use of $mail-&gt;AltBody is completely optional. If not used, PHPMailer\r
+  will use the HTML text with htmlentities().</li>\r
+  <li>the background= and &lt;img src= images were processed without any directives\r
+  or methods from the PHP script</li>\r
+  <li>there is no specific code to define the image type ... that is handled\r
+  automatically by PHPMailer when it parses the images</li>\r
+  <li>we are using a new class method '$mail->MsgHTML($body)' ... that is what will handle the parsing of the images and creating the AltBody text</li>\r
+</ul>\r
+<p>Of course, you can still use PHPMailer the same way you have in the past.\r
+That provides full compatibility with all existing scripts, while new scripts\r
+can take advantage of the new features.</p>\r
+<p>Modify test_mail.php now with your own email address and try it out.</p>\r
+To see what the email SHOULD look like in your HTML compatible email viewer: <a href="contents.html">click here</a><br>\r
+\r