Email really only deals with the ASCII charset. As a result anything outside of this charset really needs to be base 64 encoded. You are already torturing the mailserver by sending non ascii chars in the body (ie e acute). It may be your CSV contains non ASCII chars and this is causing the mail server to barf.
However, the problem is probably this:
$smtp->datasend("Content-type: multipart/mixed;
boundary=\"frontier\"\n");
# needs to be all on one line or like this:
$smtp->datasend("Content-type: multipart/mixed;
boundary=\"frontier\"\n");
The whitespace before boundary indicates that is the line continuation (it is), but in your code you send it as a header line (it isn't). It does not really explain your symptoms as described, but is wrong and should fail.
As you seem hell bent on rolling your own solution I suggest you base64 encode your CSV and send it as binary. You can just cut and paste the < 30 lines of code from MIME::Base64 encode routine to do this. BTW I would not use just "frontier" as your multipart boundary. "==frontier==", which will become "--==frontier==" would seem a far more improbable boundary.
You can make your code a lot more readable if you use a HEREDOC.
my $body = ....
my $attach = .... # base 64 encoded data
my $a_name = .....
my $email =<<EMAIL;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==frontier=="
This is a multi-part message in MIME format.
--==frontier==
Content-Transfer-Encoding: binary
Content-Type: text/plain
$body
--==frontier==
Content-Transfer-Encoding: base64
Content-Type: application/octet-stream; name="$a_name"
$attach
--==frontier==--
EMAIL
$smtp->datasend($email)
$smtp->dataend()
$smtp->quit;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|