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
mime-smtp.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
- set 'text/plain' and 'text/html' version of message
25
- send mail directly to client (without MTA support)
26
- print result
27
*/
28
29
// manage errors
30
error_reporting(E_ALL);
// php errors
31
define(
'DISPLAY_XPM4_ERRORS'
,
true
);
// display XPM4 errors
32
33
// path to 'SMTP.php' file from XPM4 package
34
require_once
'../SMTP.php'
;
35
36
// CONFIGURATION ------------------
37
$from
=
'me@mydomain.net'
;
// from mail address
38
$to
=
'client@destination.net'
;
// to mail address
39
$subj
=
'Hello World!'
;
// mail subject
40
$text
=
'Text version of message.'
;
// text/plain version of message
41
$html
=
'<b>HTML</b> version of <u>message</u>.'
;
// text/html version of message
42
// CONFIGURATION ------------------
43
44
// set text/plain version of message
45
$msg1
= MIME::message(
$text
,
'text/plain'
);
46
// set text/html version of message
47
$msg2
= MIME::message(
$html
,
'text/html'
);
48
// compose message in MIME format
49
$mess
= MIME::compose(
$msg1
,
$msg2
);
50
// standard mail message RFC2822
51
$body
=
'From: '
.$from.
"\r\n"
.
52
'To: '
.$to.
"\r\n"
.
53
'Subject: '
.$subj.
"\r\n"
.
54
$mess
[
'header'
].
"\r\n\r\n"
.
55
$mess
[
'content'
];
56
57
// get client hostname
58
$expl
= explode(
'@'
,
$to
);
59
60
// connect to SMTP server (direct) from MX hosts list
61
$conn
= SMTP::mxconnect(
$expl
[1]) or die(print_r(
$_RESULT
));
62
63
// send mail
64
$sent
= SMTP::send(
$conn
, array(
$to
),
$body
,
$from
);
65
66
// print result
67
if (
$sent
) echo 'Sent !';
68
else
print_r($_RESULT);
69
70
// disconnect from SMTP server
71
SMTP::disconnect($conn);
72
73
?>
Generated on Tue Mar 12 2013 11:27:42 for Xataface Email Module by
1.8.1.2