Xataface Email Module
0.3.2
Email/Mailmerge Module for Xataface
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Pages
lib
XPM
EXAMPLES
smtp-relay.php
Go to the documentation of this file.
1
<?php
2
3
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4
* *
5
* XPertMailer is a PHP Mail Class that can send and read messages in MIME format. *
6
* This file is part of the XPertMailer package (http://xpertmailer.sourceforge.net/) *
7
* Copyright (C) 2007 Tanase Laurentiu Iulian *
8
* *
9
* This library is free software; you can redistribute it and/or modify it under the *
10
* terms of the GNU Lesser General Public License as published by the Free Software *
11
* Foundation; either version 2.1 of the License, or (at your option) any later version. *
12
* *
13
* This library is distributed in the hope that it will be useful, but WITHOUT ANY *
14
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
15
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU Lesser General Public License along with *
18
* this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
19
* Fifth Floor, Boston, MA 02110-1301, USA *
20
* *
21
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22
23
/* Purpose:
24
- send mail relay (using Gmail MTA) with authentication via SSL conection (TLS encryption)
25
*/
26
27
// manage errors
28
error_reporting(E_ALL);
// php errors
29
define(
'DISPLAY_XPM4_ERRORS'
,
true
);
// display XPM4 errors
30
31
// path to 'SMTP.php' file from XPM4 package
32
require_once
'../SMTP.php'
;
33
34
$f
=
'username@gmail.com'
;
// from (Gmail mail address)
35
$t
=
'client@destination.net'
;
// to mail address
36
$p
=
'password'
;
// Gmail password
37
38
// standard mail message RFC2822
39
$m
=
'From: '
.$f.
"\r\n"
.
40
'To: '
.$t.
"\r\n"
.
41
'Subject: test'
.
"\r\n"
.
42
'Content-Type: text/plain'
.
"\r\n\r\n"
.
43
'Text message.'
;
44
45
// connect to MTA server (relay) 'smtp.gmail.com' via SSL (TLS encryption) with authentication using port '465' and timeout '10' secounds
46
// make sure you have OpenSSL module (extension) enable on your php configuration
47
$c
= SMTP::connect(
'smtp.gmail.com'
, 465,
$f
,
$p
,
'tls'
, 10) or die(print_r(
$_RESULT
));
48
49
// send mail relay
50
$s
= SMTP::send(
$c
, array(
$t
),
$m
,
$f
);
51
52
// print result
53
if (
$s
) echo 'Sent !';
54
else
print_r($_RESULT);
55
56
// disconnect
57
SMTP::disconnect($c);
58
59
?>
Generated on Tue Mar 12 2013 11:27:42 for Xataface Email Module by
1.8.1.2