note 119759 added to function.imap-append
| From: | nanomoow at gmail dot com | Date: | Fri, 19 Aug 2016 08:15:43 +0000 |
| Subject: | note 119759 added to function.imap-append | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206318@lists.php.net to get a copy of this message | ||
$fn = 'filename.zip';
$IMAPhost = 'imap.hostname.com';
// IMAP port 143, 995 or POP3 port 110, 995
$IMAPport = '143';
$IMAPssl = 'tls';
$IMAP =
'{'.$IMAPhost.':'.$IMAPport.'/imap/'.$IMAPssl.'/novalidate-cert}';
$IMAPuser = 'hello@hostname.com';
$msg ='Message text <h1 style="color: #093"> Hello </h1>';
// imap email and password
$ibox = imap_open($IMAP, $_SESSION['email'], $_SESSION['pass']);
$dmy=date("Y-m-d H:i:s");
// pack file contents
$attachment = chunk_split(base64_encode(file_get_contents('tmp/'.$fn)));
$boundary = "------=".md5(uniqid(rand()));
imap_append($ibox, $IMAP."Send"
, "From: Hello <".$IMAPuser.">\r\n"
. "To: ".$email."\r\n"
. "Date: $dmy\r\n"
. "Subject: ".$sub."\r\n"
. "MIME-Version: 1.0\r\n"
. "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n"
. "\r\n\r\n"
. "--$boundary\r\n"
. "Content-Type: text/html;\r\n\tcharset=\"utf-8\"\r\n"
. "Content-Transfer-Encoding: 8bit \r\n"
. "\r\n\r\n"
. html_entity_decode($msg)."\r\n"
. "\r\n\r\n"
. "--$boundary\r\n"
. "Content-Transfer-Encoding: base64\r\n"
. "Content-Disposition: attachment; filename=\"$fn\"\r\n"
. "\r\n" . $attachment . "\r\n"
. "\r\n\r\n\r\n"
. "--$boundary--\r\n\r\n"
);
----
Server IP: 72.52.91.14
Probable Submitter: 89.230.40.111
----
Manual Page -- http://php.net/manual/en/function.imap-append.php
Edit -- https://master.php.net/note/edit/119759
Del: integrated -- https://master.php.net/note/delete/119759/integrated
Del: useless -- https://master.php.net/note/delete/119759/useless
Del: bad code -- https://master.php.net/note/delete/119759/bad+code
Del: spam -- https://master.php.net/note/delete/119759/spam
Del: non-english -- https://master.php.net/note/delete/119759/non-english
Del: in docs -- https://master.php.net/note/delete/119759/in+docs
Del: other reasons-- https://master.php.net/note/delete/119759
Reject -- https://master.php.net/note/reject/119759
Search -- https://master.php.net/manage/user-notes.php