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

multipart email using $Server->Mail

Expand Messages
  • Fernando Munoz
    has anyone tried successfully to send Content-type: multipart/alternative email using the $Server- Mail object? I m trying to send email with boundaries for
    Message 1 of 4 , Feb 4, 2003
    • 0 Attachment
      has anyone tried successfully to send "Content-type: multipart/alternative"
      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 end
      receiving a whole text (including html code) email (I've tried several email
      clients). I'd appreciate an example.

      Thanks!
      ___________________________________________________
      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@...
    • Josh Chamas
      ... 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
      Message 2 of 4 , Feb 4, 2003
      • 0 Attachment
        Fernando Munoz wrote:
        > has anyone tried successfully to send "Content-type: multipart/alternative"
        > 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 end
        > receiving a whole text (including html code) email (I've tried several email
        > 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.

        Regards,

        Josh
        ________________________________________________________________
        Josh Chamas, Founder phone:925-552-0128
        Chamas Enterprises Inc. http://www.chamas.com
        NodeWorks Link Checking http://www.nodeworks.com


        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Philip Mak
        ... You might also try sending yourself an HTML and text e-mail with an HTML e-mail client, and looking at the raw source that it generates. Then, compare it
        Message 3 of 4 , Feb 4, 2003
        • 0 Attachment
          Fernando Munoz wrote:
          > has anyone tried successfully to send "Content-type:
          > multipart/alternative" 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 end receiving a whole text
          > (including html code) email (I've tried several email clients). I'd
          > appreciate an example.

          You might also try sending yourself an HTML and text e-mail with an
          HTML e-mail client, and looking at the raw source that it generates.

          Then, compare it with what you are generating with $Server->Mail; you
          might find what the problem is.

          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Fernando Munoz
          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
          Message 4 of 4 , Feb 5, 2003
          • 0 Attachment
            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
            docs.


            $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,
            );

            $message->send();



            And that's it. Thanks for your help !

            Fernando

            -----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:
            multipart/alternative"
            > 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
            end
            > receiving a whole text (including html code) email (I've tried several
            email
            > 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.

            Regards,

            Josh
            ________________________________________________________________
            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@...
          Your message has been successfully submitted and would be delivered to recipients shortly.