Loading ...
Sorry, an error occurred while loading the content.

1006RE: multipart email using $Server->Mail

Expand Messages
  • Fernando Munoz
    Feb 5, 2003
      Well, after trying some venues, I've got the results I was looking for using
      MIME::Lite as you suggested. I tried using the "as_string" method to
      transfer it to Body in $Server->Mail with no success, I tried various header
      configurations but, it always ended as plain text at the receiver. I'll
      probaly try again in the future. I tested this with several mail-clients and
      the result was 100% satisfactory in all of them, I know this doesn't mean
      that it'll work in every single client but I'm covered for the most popular
      ones. The solution is extremely simple and is detailed in the MIME::Lite

      $MailBodyHTML = $MAIL->create_HTML_mail(my_variables); # this is a
      for-the-purpose module I wrote
      $MailBodyText = $MAIL->create_Text_mail(my_variables);

      my $Subject = "Any appropriate subject line";

      MIME::Lite->send('smtp', "smtp.mailserver"); # I use a SMTP server; it
      obviuously works the same using the default sendmail

      my $message = MIME::Lite->new (
      From => 'sender@...',
      To => 'receiver@...',
      Subject => $Subject,
      Type => 'multipart/alternative',

      $message->attach( Type => 'TEXT',
      Data => $MailBodyText,

      $message->attach( Type =>'text/html',
      Data => $MailBodyHTML,


      And that's it. Thanks for your help !


      -----Original Message-----
      From: Josh Chamas [mailto:josh@...]
      Sent: Tuesday, February 04, 2003 10:12 PM
      To: Fernando Munoz
      Cc: 'asp@...'
      Subject: Re: multipart email using $Server->Mail

      Fernando Munoz wrote:
      > has anyone tried successfully to send "Content-type:
      > email using the $Server->Mail object? I'm trying to send email with
      > boundaries for text and html portions. I've already have html working with
      > no problem but when I try to put both formats in a message body I always
      > receiving a whole text (including html code) email (I've tried several
      > clients). I'd appreciate an example.

      I have not done this from within Apache::ASP, but it seems possible
      that you could use the MIME::Lite API, and insert the right content
      into $Server->Mail() usage, or you could use MIME::Lite->send()
      to send the message directly.

      You might also try the MIME::Lite->body_as_string() API and add that
      to the Body passed to $Server->Mail, but you might also have to add
      some special headers as well.

      Whatever your solution, if you could post what you come up with,
      that would be educational for all.


      Josh Chamas, Founder phone:925-552-0128
      Chamas Enterprises Inc. http://www.chamas.com
      NodeWorks Link Checking http://www.nodeworks.com
      Lions Gate Entertainment, Inc. [ AMEX: lgf ]
      Five Proud Years, One Independent Spirit.

      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Show all 4 messages in this topic