Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail = new PHPMailer(); // defaults to using php "mail()"
- $body = file_get_contents('contents.html');
- $body = eregi_replace("[]",'',$body);
- print ($body ); // to verify that I got the html
- $mail->AddReplyTo("reply@domain.com","my name");
- $mail->SetFrom('from@domain.com', 'my name');
- $address = "to@domain.com";
- $mail->AddAddress($address, "her name");
- $mail->Subject = "PHPMailer Test Subject via mail(), basic";
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
- $mail->MsgHTML($body);
- $mail->AddAttachment("images/phpmailer.gif"); // attachment
- $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- } else {
- echo "Message sent!";
- }
- $mail->IsSMTP();
- $mail->Host = "smtp.example.com";
- // optional
- // used only when SMTP requires authentication
- $mail->SMTPAuth = true;
- $mail->Username = 'smtp_username';
- $mail->Password = 'smtp_password';
- $mail->AddAddress($address, "her name");
- $mail->AddAddress($address);
Add Comment
Please, Sign In to add comment