Xataface Email Module 0.2
Email/Mailmerge Module for Xataface
lib/XPM/EXAMPLES/pop3-smtp.php
Go to the documentation of this file.
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 using POP before SMTP (Mail Proxy) method
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 'POP3.php' and 'SMTP.php' files from XPM4 package
00032 require_once '../POP3.php';
00033 require_once '../SMTP.php';
00034 
00035 $f = 'username@hostname.net'; // from mail address / account username
00036 $t = 'client@destination.net'; // to mail address
00037 $p = 'password'; // account password
00038 
00039 // standard mail message RFC2822
00040 $m = 'From: '.$f."\r\n".
00041      'To: '.$t."\r\n".
00042      'Subject: test'."\r\n".
00043      'Content-Type: text/plain'."\r\n\r\n".
00044      'Text message.';
00045 
00046 // connect to 'pop3.hostname.net' POP3 server address with authentication username '$f' and password '$p'
00047 $p = POP3::Connect('pop3.hostname.net', $f, $p) or die(print_r($_RESULT));
00048 // connect to 'smtp.hostname.net' SMTP server address
00049 $c = SMTP::Connect('smtp.hostname.net') or die(print_r($_RESULT));
00050 
00051 // send mail
00052 $s = SMTP::Send($c, array($t), $m, $f);
00053 
00054 // print result
00055 if ($s) echo 'Sent !';
00056 else print_r($_RESULT);
00057 
00058 // disconnect from SMTP server
00059 SMTP::Disconnect($c);
00060 // disconnect from POP3 server
00061 POP3::Disconnect($p);
00062 
00063 ?>
 All Data Structures Files Functions Variables Enumerations