Skip to content

Instantly share code, notes, and snippets.

@jptoto
Created September 15, 2014 19:13
Show Gist options
  • Save jptoto/303afff409ea5fe55a7f to your computer and use it in GitHub Desktop.
Save jptoto/303afff409ea5fe55a7f to your computer and use it in GitHub Desktop.
Sending with Markus Hedlund php class
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'Postmark/Autoloader.php';
\Postmark\Autoloader::register();
$postmarkApiKey = 'api_key';
$subject = 'test';
$message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /><title>VÃŒrktøjskasseInfo</title><style type=\"text/css\"> body {margin:0px; padding:0px; background-color:#ffffff; color:#777777; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; width:100% !important;} a, a:link, a:visited {color:#195d93; text-decoration:underline;} a:hover, a:active {text-decoration:none; color:#09416d !important;} h1, h2, h3, h1 a, h2 a, h3 a {color:#195d93 !important;} h2 {padding:0px 0px 10px 0px; margin:0px 0px 10px 0px;} h2.name {padding:0px 0px 7px 0px; margin:0px 0px 7px 0px;} h3 {padding:0px 0px 5px 0px; margin:0px 0px 5px 0px;} p {margin:0 0 14px 0; padding:0;} img {border:0; -ms-interpolation-mode: bicubic; max-width:100%;} a img {border:none;} table td {border-collapse:collapse;} td.quote {font-family:Georgia, 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:18px; line-height:20pt; color:#195d93;} span.phone a, span.noLink a{color:195d93; text-decoration:none;} .btn a:hover { background-color: #454545 !important; color: #ffffff !important; outline-color: #454545 !important;} /* Hotmail */ .ReadMsgBody {width: 100%;} .ExternalClass {width: 100%;} /* / Hotmail */ /* Media queries */ @media (max-width: 767px) { td[class=shareContainer], td[class=topContainer], td[class=container] {padding-left:20px !important; padding-right:20px !important;} table[class=row] {width:100% !important; max-width:600px !important;} img[class=wideImage], img[class=banner] {width:100% !important; height:auto !important; max-width:100%;} } @media (max-width: 560px) { td[class=twoFromThree] {display:block; width:100% !important;} td[class=inner2], td[class=authorInfo] {padding-right:30px !important;} td[class=socialIconsContainer] {display:block; width:100% !important; border-top:0px !important;} td[class=socialIcons], td[class=socialIcons2] {padding-top:0px !important; text-align:left !important; padding-left:30px !important; padding-bottom:20px !important;} } @media (max-width: 480px) { html, body {margin-right:auto; margin-left:auto;} td[class=oneFromTwo] {display:block; width:100% !important;} td[class=inner] {padding-left:30px !important; padding-right:30px !important;} td[class=inner_image] {padding-left:30px !important; padding-right:30px !important; padding-bottom:25px !important;} img[class=wideImage] {width:auto !important; margin:0 auto;} td[class=viewOnline] {display:none !important;} td[class=date] {font-size:14px !important; padding:10px 30px !important; background-color:#f4f4f4; text-align:left !important;} td[class=title] {font-size:18px !important; line-height:32px !important;} table[class=quoteContainer] {width:100% !important; float:none;} td[class=quote] {padding-right:0px !important;} td[class=spacer] {padding-top:18px !important;} } @media (max-width: 380px) { td[class=shareContainer] {padding:0px 10px !important;} td[class=topContainer] {padding:10px 10px 0px 10px !important; background-color:#e9e9e9 !important;} td[class=container] {padding:0px 10px 10px 10px!important;} table[class=row] {min-width:240px !important;} img[class=wideImage] {width:100% !important; max-width:255px;} td[class=authorInfo], td[class=socialIcons2] {text-align:center !important;} td[class=spacer2] {display:none !important;} td[class=spacer3] {padding-top:23px !important;} table[class=iconContainer], table[class=iconContainer_right] {width:100% !important; float:none !important;} table[class=authorPicture] {float:none !important; margin:0px auto !important; width:80px !important;} td[class=icon] {padding:5px 0px 25px 0px !important; text-align:center !important;} td[class=icon] img {display:inline !important;} img[class=buttonRight] {float:none !important;} img[class=bigButton] {width:100% !important; max-width:224px; height:auto !important;} h2[class=website] {font-size:22px !important;} } /* / Media queries */</style><!-- Internet Explorer fix --><!--[if IE]><style type=\"text/css\">@media (max-width: 560px) { td[class=twoFromThree], td[class=socialIconsContainer] {float:left; padding:0px;}}@media only screen and (max-width: 480px) { td[class=oneFromTwo] {float:left; padding:0px;}}@media (max-width: 380px) { span[class=phone] {display:block !important;}}</style><![endif]--><!-- / Internet Explorer fix --><!-- Windows Mobile 7 --><!--[if IEMobile 7]><style type=\"text/css\"> td[class=shareContainer], td[class=topContainer], td[class=container] {padding-left:10px !important; padding-right:10px !important;} table[class=row] {width:100% !important; max-width:600px !important;} td[class=oneFromTwo], td[class=twoFromThree] {float:left; padding:0px; display:block; width:100% !important;} td[class=socialIconsContainer] {float:left; padding:0px; display:block; width:100% !important; border-top:0px !important;} td[class=socialIcons], td[class=socialIcons2] {padding-top:0px !important; text-align:left !important; padding-left:30px !important; padding-bottom:20px !important;} td[class=inner], td[class=inner2], td[class=authorInfo] {padding-left:30px !important; padding-right:30px !important;} td[class=inner_image] {padding-left:30px !important; padding-right:30px !important; padding-bottom:25px !important;} td[class=viewOnline] {display:none !important;} td[class=date] {font-size:14px !important; padding:10px 30px !important; background-color:#f4f4f4; text-align:left !important;} td[class=title] {font-size:18px !important; line-height:32px !important;} table[class=quoteContainer] {width:100% !important; float:none;} td[class=quote] {padding-right:0px !important;} td[class=spacer] {padding-top:18px !important;} span[class=phone] {display:block !important;} img[class=banner] {width:100% !important; height:auto !important; max-width:100%;} img[class=wideImage] {width:auto !important; margin:0 auto;}</style><![endif]--><!-- / Windows Mobile 7 --><!-- Outlook --><!--[if gte mso 15]><style type=\"text/css\">.iconContainer, .quoteContainer {mso-table-rspace:0px; border-right:1px solid #ffffff;}.iconContainer_right {mso-table-rspace:0px; border-right:1px solid #ffffff; padding-right:1px;}.authorPicture {mso-table-rspace:0px; border-right:1px solid #f4f4f4;}</style><![endif]--><!-- / Outlook --></head><body><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;\"> <!-- Start of view online, tweet and share --> <tr> <td class=\"shareContainer\" style=\"padding-left:5px; padding-right:5px; background-color:#195d93;\"> <table class=\"row\" width=\"600\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; text-align:left; border-spacing:0; max-width:100%;\"> <tr> <td class=\"share\" width=\"50%\"style=\"padding-top:10px; padding-bottom:10px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:100%; color:#ffffff; text-align:right;\"> </td> <td class=\"viewOnline\" width=\"50%\"style=\"padding-top:11px; padding-bottom:10px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:100%; color:#ffffff; text-align:right\"> <a href=\"http://mailservice.xn--vrktjskasse-98a1v.info/webmail_53fdeb42b2d6b\" style=\"color:#ffffff !important; text-decoration:underline;\"><img alt=\"\" src=\"cid:viewOnline\" border=\"0\" vspace=\"0\" hspace=\"0\" align=\"absmiddle\" style=\"display:inline-block;\" /><span style=\"color:#ffffff;\">se mailen online</span></a> </td> </tr> </table> </td> </tr> <!-- End of view online, tweet and share --> <!-- Start of logo and date --> <tr> <td class=\"topContainer\" style=\"padding-left:5px; padding-right:5px; background-color:#195d93;\"> <table class=\"row\" width=\"600\" bgcolor=\"#ffffff\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; text-align:left; border-spacing:0; max-width:100%;\"> <tr> <td class=\"oneFromTwo\" width=\"70%\" valign=\"middle\" style=\"border-bottom:1px dotted #dddddd\"> <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; border-spacing:0;\"> <tr> <td class=\"inner\" style=\"padding-top:30px; padding-right:15px; padding-bottom:30px; padding-left:20px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:26px; line-height:100%; color:#195d93; font-weight:normal; letter-spacing:1px;\"> <span style=\"font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:36px;\">VÃŒrktøjskasseInfo</span><br> <span style=\"font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:12px;\">- information om jeres vÃŒrktøjskasse</span> <!--img alt=\"Logo\" src=\"cid:logo\" border=\"0\" align=\"left\" vspace=\"0\" hspace=\"0\" style=\"display:block;\" /--> </td> </tr> </table> </td> <td class=\"oneFromTwo\" width=\"30%\" valign=\"middle\" style=\"border-bottom:1px dotted #dddddd\"> <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; border-spacing:0;\"> <tr> <td class=\"date\" style=\"padding-top:20px; padding-right:30px; padding-bottom:20px; padding-left:15px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:16px; line-height:100%; color:#195d93; text-align:right;\"> <span class=\"noLink\"><img alt=\"\" src=\"cid:calendar\" border=\"0\" vspace=\"0\" hspace=\"0\" style=\"display:inline-block;white-space:nowrap;\" /> 27 Aug 16<sup>29</sup></span> </td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End of logo and date --> <!-- Start of main container --> <tr> <td class=\"container\" style=\"padding-left:5px; padding-right:5px; padding-bottom:20px; background-color:#e9e9e9;\"> <!-- Start of title on the color background --> <table class=\"row\" width=\"600\" bgcolor=\"#ffffff\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; text-align:left; border-spacing:0; max-width:100%;\"> <tr> <td height=\"2\" style=\"padding-top:3px; font-size:2px; line-height:2px;\"> </td> </tr> <tr> <td class=\"title\" bgcolor=\"#195d93\" style=\"padding-top:25px; padding-right:30px; padding-bottom:30px; padding-left:30px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:24px; line-height:36px; color:#ffffff; font-weight:300; border-right:solid 5px #195d93; border-left:solid 5px #195d93;\"> Bestilling af QR koder </td> </tr> <tr> <td height=\"2\" style=\"padding-top:3px; font-size:2px; line-height:2px; border-bottom:1px #dddddd dotted;\"> </td> </tr> </table> <!-- End of title on the color background --> <!-- Start of letter content --> <table class=\"row\" width=\"600\" bgcolor=\"#ffffff\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; text-align:left; border-spacing:0; max-width:100%;\"> <tr> <td style=\"padding-top:25px; padding-left:30px; padding-right:30px; padding-bottom:20px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:15pt; color:#777777;\"> Hej </td> </tr> <tr> <td style=\"padding-left:30px; padding-right:30px; padding-bottom:25px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:15pt; color:#777777;\"> Du har bestilt labels med QR koder til følgende vÃŒrktøj. Ordren bliver leveret indenfor 2-3 hverdage. <table width='100%' cellpadding='7' cellspacing='0' border='0' style='border-collapse:collapse; border-spacing:0;margin-top:10px;'> <tr> <td style='font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; font-style:italic;'> <i>Borehammer købt dato 18/11 2013</i> </td> </tr> <tr> <td style='font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; font-style:italic;'> <i>Slagboremaskine Akku købt dato 18/11 2013</i> </td> </tr> <tr> <td style='font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; font-style:italic;'> <i>Arbejdstøj Hue købt dato 11/08 2014</i> </td> </tr> <tr> <td style='font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; font-style:italic;'> <i>Arbejdstøj Hue købt dato 11/08 2014</i> </td> </tr> </table> <br><br>UserId: 76, companyId : 10, QrOrdersId: 33, 32, 31, 26, </td> </tr> <tr id=\"loginButton\"> <td style=\"padding-left:30px; padding-right:30px; padding-bottom:32px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:15pt; color:#777777; text-align:center;\"> <div class='btn' style='margin: 10px auto 24px auto; padding: 2px; text-align: center'><a href='http://vÃŒrktøjskasse.info/login' style=\"mso-hide: all; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; color: #ffffff !important; text-decoration: none !important; transition: background-color 0.2s, border-color 0.2s; display: inline-block; font-size: 13px; font-weight: bold; line-height: 15px; outline-color: #87b87f; outline-style: solid; outline-width: 2px; text-align: center; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); -webkit-font-smoothing: antialiased; background: #649A5B; padding: 10px 30px; border: 1px solid #ffffff;\">Log ind her</a></div> </td> </tr> <tr> <td style=\"padding-left:30px; padding-right:30px; padding-bottom:32px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:15pt; color:#777777; text-align:center;\"> Med venlig hilsen<br> Jakob Dupont </td> </tr> </table> <!-- End of letter content --> <!-- Start of footer --> <table class=\"row\" width=\"600\" bgcolor=\"#f4f4f4\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; text-align:left; border-spacing:0; max-width:100%;\"> <tr> <td class=\"twoFromThree\" width=\"65%\" valign=\"top\" style=\"border-top:1px #dddddd dotted;\"> <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; border-spacing:0;\"> <tr> <td class=\"authorInfo\" style=\"padding-top:25px; padding-left:30px; padding-right:15px; padding-bottom:25px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:15pt; color:#777777;\"> <h2 class=\"name\" style=\"margin-top:0px; margin-bottom:7px !important; padding-top:0px; padding-bottom:7px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:24px; line-height:100%; color:#195d93; font-weight:300;\"> BetaTools </h2> <span style=\"line-height:15pt; display:inline-block;\"> <img alt=\"Website:\" src=\"cid:homeIcon\" border=\"0\" height=\"12\" width=\"18\" style=\"vertical-align:-1px;\" /><span class=\"noLink\" style=\"color:#195d93;\">Valdemars Alle 67, 2860 Søborg</span> </span> <br/> <span style=\"line-height:15pt; display:inline-block;\"> <img alt=\"Email:\" src=\"cid:emailIcon\" border=\"0\" height=\"8\" width=\"17\" /><a style=\"text-decoration:none; color:#195d93;\" href=\"mailto:support@betatools.dk\">support@betatools.dk</a> </span> <br/> <span style=\"line-height:15pt; display:inline-block;\"> <img alt=\"Phone:\" src=\"cid:phoneIcon\" border=\"0\" height=\"10\" width=\"15\" /><span class=\"noLink\" style=\"color:#195d93;\">+45 40 726 620</span> </span> </td> </tr> </table> </td> <td class=\"socialIconsContainer\" width=\"35%\" valign=\"bottom\" style=\"border-top:1px #dddddd dotted;\"> <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse; border-spacing:0; min-width:210px;\"> <tr> <td class=\"socialIcons2\" style=\"padding-top:25px; padding-left:15px; padding-right:30px; padding-bottom:25px; font-family:'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; font-size:13px; line-height:15pt; color:#777777; text-align:right;\"> </td> </tr> </table> </td> </tr> <tr> <td colspan=\"2\" style=\"padding-top:25px; padding-left:30px; padding-right:30px; padding-bottom:25px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; line-height:15pt; color:#777777; border-top:1px #dddddd dotted;\"> Copyright © 2014 <a style=\"text-decoration:none; color:#195d93;\" href=\"http://betatools.dk\">BetaTools.dk</a>, Alle rettigheder forbeholdes. </td> </tr> </table> <!-- End of footer --> </td> </tr> <!-- End of main container --></table></body></html>";
$tag = 'test';
$recipient = 'someone@example.com';
$mailObj = Postmark\Mail::compose($postmarkApiKey)
->from('sender@example.com', 'JP Toto')
->subject($subject)
->messageHtml($message)
->messagePlain("some stuff")
->addAttachment('homeIcon.png')
->TrackOpen(true)
->Tag($tag);
$mailObj->addTo($recipient);
$mailObj->send();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment