[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Sendnig attachments via Net::SMTP
- Subject: [ale] Sendnig attachments via Net::SMTP
- From: meuon at geeklabs.com (Mike Harrison)
- Date: Mon, 7 Jun 2010 18:21:42 -0400 (EDT)
- In-reply-to: <1275942861.2513.224.camel@cfowler-desktop>
- References: <1275942861.2513.224.camel@cfowler-desktop>
On Mon, 7 Jun 2010, Chris Fowler wrote:
> Normally I generate certificate requests using openssl and mail it to
> the person requesting it. I've been working on a simple program to send
> the key and the cert as attachments via email. I have a slight problem.
> I see in debug mode of Net::SMTP that I am sending those files but when
> we receive them they show up as being 0 bytes, empty. I'm sure that I'm
> not creating the mime types correctly. The email does show and
> attachment but nothing is in those attachments!!!
The mime type seperator may be the difference.
I'm doing it in PHP this way:
$boundary='=' . md5( uniqid("boundary") );
$message .= "--$boundary\nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\n" ;
$message .= "$mailbody\n\n" ;
$message .= "--$boundary\nContent-Type: text/html; name=\"message.html\" ; charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"message.html\"\n\n" ;
$message .= "$mailhtml\n\n" ;
$message .= "--$boundary\nContent-Type: text/xml; name=\"message.xml\"; charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"message.xml\"\n\n" ;
$message .= "$mailxml\n\n" ;
$message .= "--$boundary\n" ;
Do you need the filename? I think I did.
http://www.geeklabs.com/code/gl-formmail.php.txt