| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- date_default_timezone_set('Europe/Paris');
- require_once('class.phpmailer.php');
- class PhpMail
- {
- function PhpMail()
- {
- }
- public static function sendMail( $to, $subject, $message, $attachment = null)
- {
- $mail = new PHPMailer();
- $mail->IsSMTP(); // telling the class to use SMTP
- $mail->Host = "localhost"; // SMTP server
- //$mail->Debug = 1;
- // 1 = errors and messages
- // 2 = messages only
- $mail->SMTPAuth = false; // enable SMTP authentication
- $mail->Port = 25; // set the SMTP port for the GMAIL server
- $mail->SetFrom("support@intimamedia.com", "Intimamedia support");
- $mail->AddReplyTo("support@intimamedia.com", "Intimamedia support");
- $mail->Subject = $subject;
- $mail->MsgHTML($message);
- $address = $to;
- $mail->AddAddress($address, "");
- if ($attachment)
- $mail->AddAttachment($attachment); // attachment
- if(!$mail->Send())
- {
- $ff = fopen("mailError.log", "a+");
- fprintf($ff, "Mailer Error: %s\n", $mail->ErrorInfo);
- fclose($ff);
- return false;
- }
- return true;
- }
- }
- ?>
|