![]() |
Xataface Email Module 0.2
Email/Mailmerge Module for Xataface
|
00001 <?php 00002 00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00004 * * 00005 * XPertMailer is a PHP Mail Class that can send and read messages in MIME format. * 00006 * This file is part of the XPertMailer package (http://xpertmailer.sourceforge.net/) * 00007 * Copyright (C) 2007 Tanase Laurentiu Iulian * 00008 * * 00009 * This library is free software; you can redistribute it and/or modify it under the * 00010 * terms of the GNU Lesser General Public License as published by the Free Software * 00011 * Foundation; either version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, but WITHOUT ANY * 00014 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 00015 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU Lesser General Public License along with * 00018 * this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, * 00019 * Fifth Floor, Boston, MA 02110-1301, USA * 00020 * * 00021 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00022 00023 /* Purpose: 00024 - send mail relay (using Gmail MTA) with authentication via SSL conection (TLS encryption) 00025 */ 00026 00027 // manage errors 00028 error_reporting(E_ALL); // php errors 00029 define('DISPLAY_XPM4_ERRORS', true); // display XPM4 errors 00030 00031 // path to 'SMTP.php' file from XPM4 package 00032 require_once '../SMTP.php'; 00033 00034 $f = 'username@gmail.com'; // from (Gmail mail address) 00035 $t = 'client@destination.net'; // to mail address 00036 $p = 'password'; // Gmail password 00037 00038 // standard mail message RFC2822 00039 $m = 'From: '.$f."\r\n". 00040 'To: '.$t."\r\n". 00041 'Subject: test'."\r\n". 00042 'Content-Type: text/plain'."\r\n\r\n". 00043 'Text message.'; 00044 00045 // connect to MTA server (relay) 'smtp.gmail.com' via SSL (TLS encryption) with authentication using port '465' and timeout '10' secounds 00046 // make sure you have OpenSSL module (extension) enable on your php configuration 00047 $c = SMTP::connect('smtp.gmail.com', 465, $f, $p, 'tls', 10) or die(print_r($_RESULT)); 00048 00049 // send mail relay 00050 $s = SMTP::send($c, array($t), $m, $f); 00051 00052 // print result 00053 if ($s) echo 'Sent !'; 00054 else print_r($_RESULT); 00055 00056 // disconnect 00057 SMTP::disconnect($c); 00058 00059 ?>