Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $senderName = 'Erick Best';
- $username = 'sender@yahoo.com';
- $password = 'your yahoo password';
- $recipients = array(
- 'erickbestism@gmail.com' => 'Erick Best',
- 'receiver@yahoo.com' => 'Yahoo User',
- );
- require '../PHPMailerAutoload.php';
- //Create a new PHPMailer instance
- $mail = new PHPMailer();
- // Set up SMTP
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->Host = "smtp.mail.yahoo.com";
- $mail->Port = 465;
- $mail->Username = $username
- $mail->Password = $password
- // Build the message
- $mail->Subject = 'PHPMailer mail() test';
- $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
- $mail->AltBody = 'This is a plain-text message body';
- $mail->addAttachment('images/phpmailer_mini.gif');
- // Set the from/to
- $mail->setFrom($username, $senderName);
- foreach ($recipients as $address => $name) {
- $mail->addAddress($address, $name);
- }
- //send the message, check for errors
- if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- } else {
- echo "Message sent!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement