Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- require("lib/class.phpmailer.php");
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->Mailer = "smtp";
- $mail->Host = "ssl://smtp.gmail.com";
- $mail->Port = 465;
- $mail->Username = "XXX@XXX.com"; // SMTP username
- $mail->Password = "XXXXXXX"; // SMTP password
- $mail->From = $email;
- $mail->AddAddress("XXXXXX@XXX.com", "XX XX XX");
- $mail->WordWrap = 50;
- $mail->IsHTML(true);
- $mail->Subject = "You have received feedback from your website!";
- $mail->Body = $message;
- $mail->AltBody = $message;
- if(!$mail->Send())
- {
- echo "Message could not be sent. <p>";
- echo "Mailer Error: " . $mail->ErrorInfo;
- exit;
- }
- }
- ?>
- SMTP Error: Could not connect to SMTP host. Message could not be sent.
- Mailer Error: SMTP Error: Could not connect to SMTP host.
- <?php
- require("phpmailer/class.phpmailer.php");
- $mail = new PHPMailer();
- $mail->IsSMTP(); // send via SMTP
- IsSMTP(); // send via SMTP
- $mail->SMTPAuth = true; // turn on SMTP authentication
- $mail->Username = "username@gmail.com"; // SMTP username
- $mail->Password = "password"; // SMTP password
- $webmaster_email = "username@doamin.com"; //Reply to this email ID
- $email="username@domain.com"; // Recipients email ID
- $name="name"; // Recipient's name
- $mail->From = $webmaster_email;
- $mail->FromName = "Webmaster";
- $mail->AddAddress($email,$name);
- $mail->AddReplyTo($webmaster_email,"Webmaster");
- $mail->WordWrap = 50; // set word wrap
- $mail->IsHTML(true); // send as HTML
- $mail->Subject = "This is the subject";
- $mail->Body = "This is the HTML BODY "; //HTML Body
- $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
- if(!$mail->Send())
- {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else
- {
- echo "Message has been sent";
- }
- ?>
Add Comment
Please, Sign In to add comment