note 113171 added to function.imap-mail-compose

From: Date: Sun, 08 Sep 2013 17:54:29 +0000
Subject: note 113171 added to function.imap-mail-compose
Groups: php.notes 
Request: Send a blank email to php-notes+get-196197@lists.php.net to get a copy of this message
So following on from their example, once you've composed your email with attachment or whatever, you'll probably want to send it. since imap_mail(...) takes the message as body and re-encodes it, ignoring all the hard work you've done already. Only real solution I found is to post it yourself: // open connect to mail server $socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP); if ($socket===false) { die('Error: socket_create, '.socket_strerror(socket_last_error())); } $server="myserver.com"; // say 10.0.0.1 or whatever your mail sever is $port=25; // again your mail server port, here generic smtp if (socket_connect($socket,$server,$port)) { print "Connection successful\n"; }else { die('Error: socket_connect, '.socket_strerror(socket_last_error())); } // send it... socket_write($socket,"HELO {$envelope["from"]}\n"); socket_write($socket,"MAIL FROM: {$envelope["from"]}\n"); socket_write($socket,"RCPT TO: {$envelope["to"]}\n"); socket_write($socket,"DATA\n"); socket_write($socket,"$message\n"); socket_write($socket,".\n"); socket_write($socket,"QUIT\n"); // done... socket_close($socket); Ofcourse the shell may work for you? echo "Hello World" | mail -s "Greeting..." -a "attachSomeFile.txt" gspot@gmail.com ---- Server IP: 94.76.225.145 Probable Submitter: 86.2.120.152 ---- Manual Page -- http://php.net/manual/en/function.imap-mail-compose.php Edit -- https://master.php.net/note/edit/113171 Del: integrated -- https://master.php.net/note/delete/113171/integrated Del: useless -- https://master.php.net/note/delete/113171/useless Del: bad code -- https://master.php.net/note/delete/113171/bad+code Del: spam -- https://master.php.net/note/delete/113171/spam Del: non-english -- https://master.php.net/note/delete/113171/non-english Del: in docs -- https://master.php.net/note/delete/113171/in+docs Del: other reasons-- https://master.php.net/note/delete/113171 Reject -- https://master.php.net/note/reject/113171 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196197) next »