123456789101112131415161718192021222324252627 |
- <?php
- function smtpmailer($to, $subject, $body, $attachment) {
- include('config.php');
- require_once('phpmailer/PHPMailerAutoload.php');
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->IsHTML(true);
- $mail->SMTPDebug = 0;
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'ssl';
- $mail->Host = 'smtp.gmail.com';
- $mail->Port = 465;
- $mail->Username = $mail_user;
- $mail->Password = $mail_password;
- $mail->SetFrom($mail_user, $mail_from_name);
- $mail->Subject = $subject;
- $mail->Body = $body;
- $mail->AddAddress($to);
- if ($attachment != null) {
- $mail->AddAttachment($attachment);
- }
- $mail->send();
- }
- ?>
|