Re: [PHP] Create multipart email
Thanks. I tried and it seems quite straightforward. However, I get the message 'could not instantiate mail function'. Seemed to have something to do with the 'to' address, but could not figure out what exactly. Also searched the internet, but did not find the solution. Any suggestion? Phpster phps...@gmail.com wrote in message news:aa68d580-47d1-4bac-a18b-c98772aaf...@gmail.com... Use phpmailer, makes it simple Bastien Sent from my iPod On May 28, 2009, at 4:47, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote: I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? See code below. function xmail($mailto, $from_mail, $from_name, $replyto, $subject, $message, $origname, $tempfile, $filetype) { $file = $tempfile; $file_size = filesize($file); $handle = fopen($file, r); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($origname); $header = From: .$from_name. .$from_mail.\r\n; $header .= Reply-To: .$replyto.\r\n; $header .= MIME-Version: 1.0\r\n; $header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n \r\n; $header .= This is a multi-part message in MIME format.\r\n; $header .= --.$uid.\r\n; $header .= Content-type:text/plain; charset=iso-8859-1\r\n; $header .= Content-Transfer-Encoding: 7bit\r\n\r\n; $header .= $message.\r\n\r\n; $header .= --.$uid.\r\n; $header .= Content-Type: .$filetype.; name=\.$name.\\r\n; // use diff. tyoes here $header .= Content-Transfer-Encoding: base64\r\n; $header .= Content-Disposition: attachment; file=\.$name.\\r\n\r \n; $header .= $content.\r\n\r\n; $header .= --.$uid.--; echo $header; if (mail($mailto, $subject, test, $header)) { echo mail send ... OK; // or use booleans here } else { echo mail send ... ERROR!; } } // how to use $my_name = Guus; $my_mail = g...@activediscovery.net; $my_replyto = g...@activediscovery.net; $my_subject = This is a mail with attachment.; $my_message = Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf; xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto, $my_subject, $my_message,$fileName, $fileTempName, $fileType); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
A bit of overkill, but it seems to work. Thanks! Eric Butera eric.but...@gmail.com wrote in message news:6a8639eb0905280823r162f91a0v15725e0dc7543...@mail.gmail.com... On Thu, May 28, 2009 at 4:47 AM, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote: I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? If you value your time then use Zend_Mail and be done with it. :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Create multipart email
I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? See code below. function xmail($mailto, $from_mail, $from_name, $replyto, $subject, $message, $origname, $tempfile, $filetype) { $file = $tempfile; $file_size = filesize($file); $handle = fopen($file, r); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($origname); $header = From: .$from_name. .$from_mail.\r\n; $header .= Reply-To: .$replyto.\r\n; $header .= MIME-Version: 1.0\r\n; $header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n\r\n; $header .= This is a multi-part message in MIME format.\r\n; $header .= --.$uid.\r\n; $header .= Content-type:text/plain; charset=iso-8859-1\r\n; $header .= Content-Transfer-Encoding: 7bit\r\n\r\n; $header .= $message.\r\n\r\n; $header .= --.$uid.\r\n; $header .= Content-Type: .$filetype.; name=\.$name.\\r\n; // use diff. tyoes here $header .= Content-Transfer-Encoding: base64\r\n; $header .= Content-Disposition: attachment; file=\.$name.\\r\n\r\n; $header .= $content.\r\n\r\n; $header .= --.$uid.--; echo $header; if (mail($mailto, $subject, test, $header)) { echo mail send ... OK; // or use booleans here } else { echo mail send ... ERROR!; } } // how to use $my_name = Guus; $my_mail = g...@activediscovery.net; $my_replyto = g...@activediscovery.net; $my_subject = This is a mail with attachment.; $my_message = Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf; xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto, $my_subject, $my_message,$fileName, $fileTempName, $fileType); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
Use phpmailer, makes it simple Bastien Sent from my iPod On May 28, 2009, at 4:47, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote: I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? See code below. function xmail($mailto, $from_mail, $from_name, $replyto, $subject, $message, $origname, $tempfile, $filetype) { $file = $tempfile; $file_size = filesize($file); $handle = fopen($file, r); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($origname); $header = From: .$from_name. .$from_mail.\r\n; $header .= Reply-To: .$replyto.\r\n; $header .= MIME-Version: 1.0\r\n; $header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n \r\n; $header .= This is a multi-part message in MIME format.\r\n; $header .= --.$uid.\r\n; $header .= Content-type:text/plain; charset=iso-8859-1\r\n; $header .= Content-Transfer-Encoding: 7bit\r\n\r\n; $header .= $message.\r\n\r\n; $header .= --.$uid.\r\n; $header .= Content-Type: .$filetype.; name=\.$name.\\r\n; // use diff. tyoes here $header .= Content-Transfer-Encoding: base64\r\n; $header .= Content-Disposition: attachment; file=\.$name.\\r\n\r \n; $header .= $content.\r\n\r\n; $header .= --.$uid.--; echo $header; if (mail($mailto, $subject, test, $header)) { echo mail send ... OK; // or use booleans here } else { echo mail send ... ERROR!; } } // how to use $my_name = Guus; $my_mail = g...@activediscovery.net; $my_replyto = g...@activediscovery.net; $my_subject = This is a mail with attachment.; $my_message = Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf; xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto, $my_subject, $my_message,$fileName, $fileTempName, $fileType); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
i have been using PEAR Mail. major reason being nearly all of my web hosts have this supported (pre-installed) Kranthi. On Thu, May 28, 2009 at 17:29, Phpster phps...@gmail.com wrote: Use phpmailer, makes it simple Bastien Sent from my iPod On May 28, 2009, at 4:47, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote: I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? See code below. function xmail($mailto, $from_mail, $from_name, $replyto, $subject, $message, $origname, $tempfile, $filetype) { $file = $tempfile; $file_size = filesize($file); $handle = fopen($file, r); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($origname); $header = From: .$from_name. .$from_mail.\r\n; $header .= Reply-To: .$replyto.\r\n; $header .= MIME-Version: 1.0\r\n; $header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n\r\n; $header .= This is a multi-part message in MIME format.\r\n; $header .= --.$uid.\r\n; $header .= Content-type:text/plain; charset=iso-8859-1\r\n; $header .= Content-Transfer-Encoding: 7bit\r\n\r\n; $header .= $message.\r\n\r\n; $header .= --.$uid.\r\n; $header .= Content-Type: .$filetype.; name=\.$name.\\r\n; // use diff. tyoes here $header .= Content-Transfer-Encoding: base64\r\n; $header .= Content-Disposition: attachment; file=\.$name.\\r\n\r\n; $header .= $content.\r\n\r\n; $header .= --.$uid.--; echo $header; if (mail($mailto, $subject, test, $header)) { echo mail send ... OK; // or use booleans here } else { echo mail send ... ERROR!; } } // how to use $my_name = Guus; $my_mail = g...@activediscovery.net; $my_replyto = g...@activediscovery.net; $my_subject = This is a mail with attachment.; $my_message = Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf; xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto, $my_subject, $my_message,$fileName, $fileTempName, $fileType); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
Hi, i have been using PEAR Mail. major reason being nearly all of my web hosts have this supported (pre-installed) It doesn't need to be installed for you to use it. If you want/need to you can get the sauce off of the PEAR website: http://cvs.php.net/viewvc.cgi/pear/Mail/ Click on the version numbers to get at the code. You can then treat it like you would any other PHP file. You'll have to resolve any depenencies yourself though. -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) PHP SMTP: http://www.phpguru.org/smtp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
ohh.. what i meant is most of my web hosts hav it pre-installed (copy of that file in their include dir) so that i'll not hav to upload it again and thereby save some web space -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
guus, take a look at: http://pear.php.net/manual/en/package.mail.mail-mime.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
Guus Ellenkamp wrote: I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? Show us the entire email that doesn't work. /Per -- Per Jessen, Zürich (20.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create multipart email
On Thu, May 28, 2009 at 4:47 AM, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote: I'm trying to attach an uploaded file to an e-mail which I receive in Outlook. Neither the first part, nor the second part displays properly. The header looks ok when displayed on the screen. What am I missing? If you value your time then use Zend_Mail and be done with it. :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php