Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include_once('phpmailer/PHPMailerAutoload.php');
- echo $_SERVER['DOCUMENT_ROOT'];
- function sendmail($body){
- //Create a new PHPMailer instance
- $mail = new PHPMailer;
- //Tell PHPMailer to use SMTP
- $mail->isSMTP();
- //Enable SMTP debugging
- // 0 = off (for production use)
- // 1 = client messages
- // 2 = client and server messages
- $mail->SMTPDebug = 2;
- //Ask for HTML-friendly debug output
- $mail->Debugoutput = 'html';
- //Set the hostname of the mail server
- $mail->Host = 'smtp.gmail.com';
- // use
- // $mail->Host = gethostbyname('smtp.gmail.com');
- // if your network does not support SMTP over IPv6
- //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
- $mail->Port = 587;
- //Set the encryption system to use - ssl (deprecated) or tls
- $mail->SMTPSecure = 'tls';
- //Whether to use SMTP authentication
- $mail->SMTPAuth = true;
- $mail->Username = 'mail@gmail.com'; // SMTP username
- $mail->Password = 'pass'; // SMTP password
- $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
- // 1 = errors and messages
- // 2 = messages only
- $mail->From = 'from@from.net';
- $mail->FromName = 'Site';
- $mail->AddAddress('to@yahoo.com', 'To'); // Add a recipient
- $mail->IsHTML(true); // Set email format to HTML
- $mail->Subject = 'Site: New unmapped teams found!';
- $mail->Body = $body;
- $mail->AltBody = $body;
- if(!$mail->Send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- exit;
- }
- echo 'Message has been sent';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement