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-client.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 directly to client (without MTA support)
25
- connect to internet using IP '127.0.0.1'
26
- set hostname 'localdomain.net' for EHLO/HELO SMTP dialog
27
- set return-path in 'MAIL FROM' SMTP dialog
28
*/
29
30
// manage errors
31
error_reporting(E_ALL);
// php errors
32
define(
'DISPLAY_XPM4_ERRORS'
,
true
);
// display XPM4 errors
33
34
// path to 'SMTP.php' file from XPM4 package
35
require_once
'../SMTP.php'
;
36
37
$f
=
'me@mydomain.net'
;
// from mail address
38
$t
=
'client@destination.net'
;
// to mail address
39
$p
=
'my@address.net'
;
// return-path
40
41
// standard mail message RFC2822
42
$m
=
'From: '
.$f.
"\r\n"
.
43
'To: '
.$t.
"\r\n"
.
44
'Subject: test'
.
"\r\n"
.
45
'Content-Type: text/plain'
.
"\r\n\r\n"
.
46
'Text message.'
;
47
48
// get client hostname
49
$h
= explode(
'@'
,
$t
);
50
51
// optional, connect to the internet using IP '127.0.0.1'
52
$r
= stream_context_create(array(
'socket'
=> array(
'bindto'
=>
'127.0.0.1:0'
)));
53
54
// connect to SMTP server (direct) from MX hosts list to port '25' and timeout '10' secounds
55
// optional, set hostname 'localdomain.net' for EHLO/HELO SMTP dialog
56
$c
= SMTP::mxconnect(
$h
[1], 25, 10,
'localdomain.net'
,
$r
) or die(print_r(
$_RESULT
));
57
58
// send mail and set return-path '$p' in 'MAIL FROM' SMTP dialog
59
$s
= SMTP::send(
$c
, array(
$t
),
$m
,
$p
);
60
61
// print result
62
if (
$s
) echo 'Sent !';
63
else
print_r($_RESULT);
64
65
// disconnect
66
SMTP::disconnect($c);
67
68
?>
Generated on Tue Mar 12 2013 11:27:42 for Xataface Email Module by
1.8.1.2