Advertisement
Guest User

Untitled

a guest
Mar 12th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. [root@hlhweb-1 phpmailer]# cat index.php
  2. <?php
  3. /**
  4.  * This example shows making an SMTP connection with authentication.
  5.   */
  6.  
  7.   //SMTP needs accurate times, and the PHP time zone MUST be set
  8.   //This should be done in your php.ini, but this is how to do it if you don't have access to that
  9.   date_default_timezone_set('Etc/UTC');
  10.  
  11.   require 'PHPMailerAutoload.php';
  12.  
  13.   //Create a new PHPMailer instance
  14.   $mail = new PHPMailer;
  15.   //Tell PHPMailer to use SMTP
  16.   $mail->isSMTP();
  17.   //Enable SMTP debugging
  18.   // 0 = off (for production use)
  19.   // 1 = client messages
  20.   // 2 = client and server messages
  21.   $mail->SMTPDebug = 2;
  22.   //Ask for HTML-friendly debug output
  23.   $mail->Debugoutput = 'html';
  24.   //Set the hostname of the mail server
  25.   $mail->Host = "smtp.sendgrid.net";
  26.   //Set the SMTP port number - likely to be 25, 465 or 587
  27.   $mail->Port = 465;
  28.   //Whether to use SMTP authentication
  29.   $mail->SMTPAuth = true;
  30.   //Username to use for SMTP authentication
  31.   $mail->Username = "dynamicmind";
  32.   //Password to use for SMTP authentication
  33.   $mail->Password = "dbMSHkPYUKPerfWir0b5";
  34.   //Set who the message is to be sent from
  35.   $mail->setFrom('noreply@app.highlighthub.com ', 'First Last');
  36.   $mail->SMTPSecure = 'ssl';
  37.   //Set who the message is to be sent to
  38.   $mail->addAddress('xdieamd@gmail.com', 'John Doe');
  39.   //Set the subject line
  40.   $mail->Subject = 'PHPMailer SMTP test';
  41.   //Read an HTML message body from an external file, convert referenced images to embedded,
  42.   //convert HTML into a basic plain-text alternative body
  43.   //Replace the plain text body with one created manually
  44.   $mail->AltBody = 'This is a plain-text message body';
  45.   //Attach an image file
  46.  
  47.  
  48.  
  49. $mail->Body='zbZholaz/hol';
  50.   //send the message, check for errors
  51.   if (!$mail->send()) {
  52.       echo "Mailer Error: " . $mail->ErrorInfo;
  53.       } else {
  54.           echo "Message sent!";
  55.           }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement