in reply to Re^2: MIME::Lite and Multipart
in thread MIME::Lite and Multipart

Yes, you should know if there's attachment, because if there's no attachment you should create only one MIME::Lite object (multipart/alternative message) and there's no need to create $message at all.

Replies are listed 'Best First'.
Re^4: MIME::Lite and Multipart
by Analog (Novice) on Sep 29, 2009 at 23:29 UTC
    I understand and thank you guys for the help - I don't know if I agree though, IMO I don't think its right to need to create 2 separate :Lite objects, because if there is no attachment then I need to add the "To", "From", "Subject" keys to that "$alternative" object.

    I'm not going to complain though, MIME:Lite is a excellent module and I'm lucky it exists.

      shouldn't you only add To:, Subject:,... to the outermost ::Lite object :)? You insert the alternative ::Lite object into the outer ::Lite object just to get the MIME hierarchy. To:, ... is only used for the mail header, and that only makes sense with the outer ::Lite object finally being mailed (i.e. $message). So you better agree with zwon :)

      For more info on the mail format and smtp: Check out the original rfc822 and maybe its updates and MIME extension updates for more on the actual email format. Or look at an mbox file on a unix box. As you have an smtp service active, try talking to it with telnet localhost 25 and smtp/esmtp commands (unless the mailer's secured/paranoid even against localhost; maybe strace/truss the mailer process)