Guest User

Untitled

a guest
Dec 22nd, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.51 KB | None | 0 0
  1.  <?php
  2.  
  3.  
  4.  $message="<html>
  5. <head>
  6. <meta name='viewport' content='width=device-width' />
  7. <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
  8. <title>Send Emails</title>";
  9.  
  10.  
  11.  $message .="<style>
  12. /* -------------------------------------
  13.    GLOBAL
  14.    A very basic CSS reset
  15. ------------------------------------- */
  16. * {
  17.  margin: 0;
  18.  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  19.  box-sizing: border-box;
  20.  font-size: 14px;
  21. }
  22.  
  23. img {
  24.  max-width: 100%;
  25. }
  26.  
  27. body {
  28.  -webkit-font-smoothing: antialiased;
  29.  -webkit-text-size-adjust: none;
  30.  width: 100% !important;
  31.  height: 100%;
  32.  line-height: 1.6em;
  33.  /* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
  34.  /*line-height: 22px;*/
  35. }
  36.  
  37. /* Let's make sure all tables have defaults */
  38. table td {
  39.  vertical-align: top;
  40. }
  41.  
  42. /* -------------------------------------
  43.    BODY & CONTAINER
  44. ------------------------------------- */
  45. body {
  46.  background-color: #f6f6f6;
  47. }
  48.  
  49. .body-wrap {
  50.  background-color: #f6f6f6;
  51.  width: 100%;
  52. }
  53.  
  54. .container {
  55.  display: block !important;
  56.  max-width: 600px !important;
  57.  margin: 0 auto !important;
  58.  /* makes it centered */
  59.  clear: both !important;
  60. }
  61.  
  62. .content {
  63.  max-width: 600px;
  64.  margin: 0 auto;
  65.  display: block;
  66.  padding: 20px;
  67. }
  68.  
  69. /* -------------------------------------
  70.    HEADER, FOOTER, MAIN
  71. ------------------------------------- */
  72. .main {
  73.  background-color: #fff;
  74.  border: 1px solid #e9e9e9;
  75.  border-radius: 3px;
  76. }
  77.  
  78. .content-wrap {
  79.  padding: 20px;
  80. }
  81.  
  82. .content-block {
  83.  padding: 0 0 20px;
  84. }
  85.  
  86. .header {
  87.  width: 100%;
  88.  margin-bottom: 20px;
  89. }
  90.  
  91. .footer {
  92.  width: 100%;
  93.  clear: both;
  94.  color: #999;
  95.  padding: 20px;
  96. }
  97. .footer p, .footer a, .footer td {
  98.  color: #999;
  99.  font-size: 12px;
  100. }
  101.  
  102. /* -------------------------------------
  103.    TYPOGRAPHY
  104. ------------------------------------- */
  105. h1, h2, h3 {
  106.  font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
  107.  color: #000;
  108.  margin: 40px 0 0;
  109.  line-height: 1.2em;
  110.  font-weight: 400;
  111. }
  112.  
  113. h1 {
  114.  font-size: 32px;
  115.  font-weight: 500;
  116.  /* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
  117.  /*line-height: 38px;*/
  118. }
  119.  
  120. h2 {
  121.  font-size: 24px;
  122.  /* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
  123.  /*line-height: 29px;*/
  124. }
  125.  
  126. h3 {
  127.  font-size: 18px;
  128.  /* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
  129.  /*line-height: 22px;*/
  130. }
  131.  
  132. h4 {
  133.  font-size: 14px;
  134.  font-weight: 600;
  135. }
  136.  
  137. p, ul, ol {
  138.  margin-bottom: 10px;
  139.  font-weight: normal;
  140. }
  141. p li, ul li, ol li {
  142.  margin-left: 5px;
  143.  list-style-position: inside;
  144. }
  145.  
  146. /* -------------------------------------
  147.    LINKS & BUTTONS
  148. ------------------------------------- */
  149. a {
  150.  color: #348eda;
  151.  text-decoration: underline;
  152. }
  153.  
  154. .btn-primary {
  155.  text-decoration: none;
  156.  color: #FFF;
  157.  background-color: #348eda;
  158.  border: solid #348eda;
  159.  border-width: 10px 20px;
  160.  line-height: 2em;
  161.  /* 2em * 14px = 28px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
  162.  /*line-height: 28px;*/
  163.  font-weight: bold;
  164.  text-align: center;
  165.  cursor: pointer;
  166.  display: inline-block;
  167.  border-radius: 5px;
  168.  text-transform: capitalize;
  169. }
  170.  
  171. /* -------------------------------------
  172.    OTHER STYLES THAT MIGHT BE USEFUL
  173. ------------------------------------- */
  174. .last {
  175.  margin-bottom: 0;
  176. }
  177.  
  178. .first {
  179.  margin-top: 0;
  180. }
  181.  
  182. .aligncenter {
  183.  text-align: center;
  184. }
  185.  
  186. .alignright {
  187.  text-align: right;
  188. }
  189.  
  190. .alignleft {
  191.  text-align: left;
  192. }
  193.  
  194. .clear {
  195.  clear: both;
  196. }
  197.  
  198. /* -------------------------------------
  199.    ALERTS
  200.    Change the class depending on warning email, good email or bad email
  201. ------------------------------------- */
  202. .alert {
  203.  
  204.  font-size: 16px;
  205.  color: #fff;
  206.  font-weight: 500;
  207.  padding: 20px;
  208.  text-align: center;
  209.  border-radius: 3px 3px 0 0;
  210. }
  211. .alert a {
  212.  color: #fff;
  213.  text-decoration: none;
  214.  font-weight: 500;
  215.  font-size: 16px;
  216. }
  217. .alert.alert-warning {
  218.  background-color: #FF9F00;
  219. }
  220. .alert.alert-bad {
  221.  background-color: #D0021B;
  222. }
  223. .alert.alert-good {
  224.  background-color: #68B90F;
  225. }
  226.  
  227. /* -------------------------------------
  228.    INVOICE
  229.    Styles for the billing table
  230. ------------------------------------- */
  231. .invoice {
  232.  margin: 40px auto;
  233.  text-align: left;
  234.  width: 80%;
  235. }
  236. .invoice td {
  237.  padding: 5px 0;
  238. }
  239. .invoice .invoice-items {
  240.  width: 100%;
  241. }
  242. .invoice .invoice-items td {
  243.  border-top: #eee 1px solid;
  244. }
  245. .invoice .invoice-items .total td {
  246.  border-top: 2px solid #333;
  247.  border-bottom: 2px solid #333;
  248.  font-weight: 700;
  249. }
  250.  
  251. /* -------------------------------------
  252.    RESPONSIVE AND MOBILE FRIENDLY STYLES
  253. ------------------------------------- */
  254. @media only screen and (max-width: 640px) {
  255.  body {
  256.    padding: 0 !important;
  257.  }
  258.  
  259.  h1, h2, h3, h4 {
  260.    font-weight: 800 !important;
  261.    margin: 20px 0 5px !important;
  262.  }
  263.  
  264.  h1 {
  265.    font-size: 22px !important;
  266.  }
  267.  
  268.  h2 {
  269.    font-size: 18px !important;
  270.  }
  271.  
  272.  h3 {
  273.    font-size: 16px !important;
  274.  }
  275.  
  276.  .container {
  277.    padding: 0 !important;
  278.    width: 100% !important;
  279.  }
  280.  
  281.  .content {
  282.    padding: 0 !important;
  283.  }
  284.  
  285.  .content-wrap {
  286.    padding: 10px !important;
  287.  }
  288.  
  289.  .invoice {
  290.    width: 100% !important;
  291.  }
  292. }
  293.  
  294. /*# sourceMappingURL=styles.css.map */
  295.  
  296. </style>
  297. </head>";
  298.  
  299.  $message .="<body>
  300.  
  301. <table class='body-wrap'>
  302.     <tr>
  303.         <td></td>
  304.         <td class='container' width='600'>
  305.             <div class='content'>
  306.                 <table class='main' width='100%' cellpadding='0' cellspacing='0'>
  307.                     <tr>
  308.                         <td class='content-wrap aligncenter'>
  309.                             <table width='100%' cellpadding='0' cellspacing='0'>
  310.                                 <tr>
  311.                                     <td class='content-block'>
  312.                                         <h1 class='aligncenter'>$33.98 Paid</h1>
  313.                                     </td>
  314.                                 </tr>
  315.                                 <tr>
  316.                                     <td class='content-block'>
  317.                                         <h2 class='aligncenter'>Thanks for using AMGC.</h2>
  318.                                     </td>
  319.                                 </tr>
  320.                                 <tr>
  321.                                     <td class='content-block aligncenter'>
  322.                                         <table class='invoice'>
  323.                                             <tr>
  324.                                                 <td>Lee Munroe<br>Invoice #12345<br>June 01 2014</td>
  325.                                             </tr>
  326.                                             <tr>
  327.                                                 <td>
  328.                                                     <table class='invoice-items' cellpadding='0' cellspacing='0'>
  329.                                                         <tr>
  330.                                                             <td>Service 1</td>
  331.                                                             <td class='alignright'>$ 19.99</td>
  332.                                                         </tr>
  333.                                                         <tr>
  334.                                                             <td>Service 2</td>
  335.                                                             <td class='alignright'>$ 9.99</td>
  336.                                                         </tr>
  337.                                                         <tr>
  338.                                                             <td>Service 3</td>
  339.                                                             <td class='alignright'>$ 4.00</td>
  340.                                                         </tr>
  341.                                                         <tr class='total'>
  342.                                                             <td class='alignright' width='80%'>Total</td>
  343.                                                             <td class='alignright'>$ 33.98</td>
  344.                                                         </tr>
  345.                                                     </table>
  346.                                                 </td>
  347.                                             </tr>
  348.                                         </table>
  349.                                     </td>
  350.                                 </tr>
  351.                                 <tr>
  352.                                     <td class='content-block aligncenter'>
  353.                                         <a href='http://www.mailgun.com'>View in browser</a>
  354.                                     </td>
  355.                                 </tr>
  356.                                 <tr>
  357.                                     <td class='content-block aligncenter'>
  358.                                         Acme Inc. 123 Van Ness, San Francisco 94102
  359.                                     </td>
  360.                                 </tr>
  361.                             </table>
  362.                         </td>
  363.                     </tr>
  364.                 </table>
  365.                 <div class='footer'>
  366.                     <table width='100%'>
  367.                         <tr>
  368.                             <td class='aligncenter content-block'>Questions? Email <a href='mailto:'>support@acme.inc</a></td>
  369.                         </tr>
  370.                     </table>
  371.                 </div></div>
  372.         </td>
  373.         <td></td>
  374.     </tr>
  375. </table>
  376.  
  377. </body>
  378. </html>";
  379.  
  380. echo $message;
  381. require_once('class.phpmailer.php');
  382.  
  383. $mail             = new PHPMailer();
  384.  
  385.  
  386.  
  387. $mail->AddReplyTo("name@yourdomain.com","First Last");
  388.  
  389. $mail->SetFrom('admin@amtargc.com', 'AGC');
  390.  
  391. $mail->AddReplyTo("name@yourdomain.com","First Last");
  392.  
  393. $address = "nadeemflyer@gmail.com";
  394. $mail->AddAddress($address, "John Doe");
  395.  
  396. $mail->Subject    = "Voucher Details";
  397.  
  398. $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
  399.  
  400. $mail->MsgHTML($message);
  401.  
  402. $mail->AddAttachment("images/phpmailer.gif");      
  403. $mail->AddAttachment("images/phpmailer_mini.gif");
  404.  
  405. if(!$mail->Send()) {
  406.   echo "Mailer Error: " . $mail->ErrorInfo;
  407. } else {
  408.   echo " Yes Message sent successfully!";
  409. }
  410. ?>
Add Comment
Please, Sign In to add comment