Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('PHPMailer/PHPMailerAutoload.php');
- class Mail {
- public static function sendMail($subject, $body, $address) {
- try
- {
- $mail = new PHPMailer();
- $mail->IsSMTP();
- //$mail->SMTPDebug = 4;
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'ssl';
- $mail->SMTPOptions = array
- (
- 'ssl' => array
- (
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 465;
- $mail->IsHTML(true);
- $mail->Username = "**********@gmail.com";
- $mail->Password = "*******";
- $mail->SetFrom("*************@gmail.com");
- $mail->Subject = $subject;
- $mail->Body = $body;
- $mail->AddAddress($address);
- if(!$mail->Send())
- {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- }
- catch (phpmailerException $e)
- {
- $errors[] = $e->errorMessage();
- }
- catch (Exception $e)
- {
- $errors[] = $e->getMessage();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement