cjmchch Posted March 20, 2007 Posted March 20, 2007 I have installed a contribute that I have tweaked somewhat to deliver an invoice via email to the customer upon confirmation of order (this is instead of the confirmation order email that is normally sent. This works just fine as does the duplicate copy it sends to the sellers email for fulfilling the order. This is where it gets a little difficult.....the email is sent to an outlook email system and of course, microsoft being microsoft, they don't facilitate the changing of the way that the memo style is printed out. I want to be able to print out at the sellers end the body of the message only, so that once the order is filled the same piece of paper can be sent with the order as the packing slip/invoice. ( a duplicate would be retained for accounting purposes) There is no way I can find to alter outlook to print only the body without all the header junk so rather than buy a plug in to do it, is there a way that I can send the info as an attachment from the store(confirmation button) instead of it being as an html formatted email. So the question remains, does anybody know a way that i can send the invoice as an attachment rather than as an html formatted email. Any help appreciated, thanks.
Guest Posted March 20, 2007 Posted March 20, 2007 yes you can send attachments with emails from the oscommerce store but it's not built-in and I don't know if a contribution exists for it. You need to use the php imap functions for it and create your own module. here is an example from php.net is really basic but gives you an understanding what needs to be done. http://www.php.net/manual/en/function.imap-mail-compose.php <?php $envelope["from"]= "[email protected]"; $envelope["to"] = "[email protected]"; $envelope["cc"] = "[email protected]"; $part1["type"] = TYPEMULTIPART; $part1["subtype"] = "mixed"; $filename = "/tmp/imap.c.gz"; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); $part2["type"] = TYPEAPPLICATION; $part2["encoding"] = ENCBINARY; $part2["subtype"] = "octet-stream"; $part2["description"] = basename($filename); $part2["contents.data"] = $contents; $part3["type"] = TYPETEXT; $part3["subtype"] = "plain"; $part3["description"] = "description3"; $part3["contents.data"] = "contents.data3\n\n\n\t"; $body[1] = $part1; $body[2] = $part2; $body[3] = $part3; echo nl2br(imap_mail_compose($envelope, $body)); ?>
cjmchch Posted March 21, 2007 Author Posted March 21, 2007 yes you can send attachments with emails from the oscommerce store but it's not built-in and I don't know if a contribution exists for it. You need to use the php imap functions for it and create your own module. here is an example from php.net is really basic but gives you an understanding what needs to be done. http://www.php.net/manual/en/function.imap-mail-compose.php <?php $envelope["from"]= "[email protected]"; $envelope["to"] = "[email protected]"; $envelope["cc"] = "[email protected]"; $part1["type"] = TYPEMULTIPART; $part1["subtype"] = "mixed"; $filename = "/tmp/imap.c.gz"; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); $part2["type"] = TYPEAPPLICATION; $part2["encoding"] = ENCBINARY; $part2["subtype"] = "octet-stream"; $part2["description"] = basename($filename); $part2["contents.data"] = $contents; $part3["type"] = TYPETEXT; $part3["subtype"] = "plain"; $part3["description"] = "description3"; $part3["contents.data"] = "contents.data3\n\n\n\t"; $body[1] = $part1; $body[2] = $part2; $body[3] = $part3; echo nl2br(imap_mail_compose($envelope, $body)); ?> Thanks for that. I have actually found a work around for my issue which is easier than the attachment option. I have created a Visual Basic routine and an Outlook rule that checks my email messages when they arrive and sends the message body directly to the printer. I don't even have to open the email. It is the perfect answer. I'll put the code into a contribute for those who get copies of invoices sent to them via email, especially those who have graphic content in their message body.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.