neversaint has asked for the wisdom of the Perl Monks concerning the following question:

Dear Masters,

I have the following script. Which use MIME::Lite, now problem I have is that only web-based email client (e.g. gmail, yahoo, hotmail, server_webmail) can receive email sent by this script.

Is there any module that is more robust, which can be opened both web based and console based (e.g. pine, mutt) email client.
use MIME::Lite; my $for_whom = "somebody@tolove.com"; my $sender_email = "lonely@girl.com"; my $message = "Forget me not"; my $subject = "FOO BAR"; send_email_noattach($for_whom,$sender_email,$message,$subject); sub send_email_noattach { # using MIME::Lite my ( $target_add, $my_add, $mssg, $subject ) = @_; my $msg = MIME::Lite->new( From => $my_add, To => $target_add, Subject => $subject, Type => 'multipart/plain', ); $msg->attach( Type => 'TEXT', Data => $mssg ); $msg->send(); return; }


---
neversaint and everlastingly indebted.......

Replies are listed 'Best First'.
Re: Looking for Console Friendly Mailer Module
by gellyfish (Monsignor) on May 20, 2006 at 08:31 UTC

    I'm not so sure that the messages can't be received by the text based clients, I just think that they don't know what to do with them. You don't need to send a multipart mail anyway if all you are sending is plain text, but I don't think that multipart/plain is actually a legitimate content type, and if it is I don't think it us going to be understood by the majority of clients. You either need to use multipart/alternative and include an HTML part or just use a single part like:

    my $msg = MIME::Lite->new( From => $my_add, To => $target_add, Subject => $subject, Type => 'TEXT', Data => $mssg );

    /J\

Re: Looking for Console Friendly Mailer Module
by pKai (Priest) on May 20, 2006 at 10:13 UTC

    Sending a TEXT attachment (read text/plain in Mime speak) as the only part of a multipart message has its advantages.

    You can expect that long lines (read links) aren't broken apart by the mailer software non-reversible, as it will happen with such beasts in text/plain messages often.

    Anyway, the correct Type for such a message is multipart/mixed, see also the corresponding example in the MIME::Lite doc.

Re: Looking for Console Friendly Mailer Module
by bart (Canon) on May 20, 2006 at 14:59 UTC
    You can easily use MIME::Lite to send MIME-free mail messages. I'm guessing that is what you want. ANd it's as simple as this: don't attach anything, put the mail body in the "Data" parameter.
A reply falls below the community's threshold of quality. You may see it by logging in.