SMTP From field using MIME::Lite

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default SMTP From field using MIME::Lite

    I wrote the following code:

    MIME::Lite->send('smtp', "mail.myserver.com", Timeout=>60);

    $msg = MIME::Lite->new(
    From =>"administrator\@myserver.com",
    To =>'user@company.org',
    Subject =>"TEST",
    Data =>"TEST",

    );

    $msg->send;


    I want to have a display name present in the "From" field. In other
    words, I would like the 'From' field to read:

    Reporting Agent <administrator@myserver.com>

    I can't seem to do this no matter what I try. Can I do this with
    MIME::Lite?

    --Paul

    Paul Harwood Guest

  2. Similar Questions and Discussions

    1. How to log the output of Mime::Lite ?
      I have this simple Mime::Lite script quoted below. It works alright. But I would like to trace the result of the output. Something like set -x in...
    2. MIME::Lite 3.01 in CGI script doing nothing
      comp.lang.perl.modules: I am running: <CVSENV>root@d3020g:~/d3020g# perl -v This is perl, v5.6.1 built for i386-linux ... ...
    3. Questions about Net::SMTP and MIME::Lite
      Hi, In my perl-script I'm using MIME::Lite and Net::SMTP. The modules I use within my perl-script are located in a sub-directory called...
    4. MIME::LITE question
      I would like to have a display name present in the FROM field of messages I send. Example: Reporting Agent < reportingagent@company.com > All...
    5. How to Add Username/Password for SMTP Authentication in MIME::Lite?
      Is it possible to use MIME::Lite using a SMTP server that needs authentication? My provider now demands authentification when sending mail via...
  3. #2

    Default RE: SMTP From field using MIME::Lite

    > I wrote the following code:
    >
    > MIME::Lite->send('smtp', "mail.myserver.com", Timeout=>60);
    >
    > $msg = MIME::Lite->new(
    > From =>"administrator\@myserver.com",
    > To =>'user@company.org',
    >
    > Subject =>"TEST",
    > Data =>"TEST",
    >
    > );
    >
    > $msg->send;
    >
    >
    > I want to have a display name present in the "From" field. In
    > other words, I would like the 'From' field to read:
    Your code is correct. I would write the from as
    'administrator@myserver.com' to avoid esaping the @.
    What do you get back when this is sent? This is a text only message
    correct?

    Here are some examples from the docs...

    Create a simple message containing just text
    $msg = MIME::Lite->new(
    From =>'me@myhost.com',
    To =>'you@yourhost.com',
    Cc =>'some@other.com, [email]some@more.com[/email]',
    Subject =>'Helloooooo, nurse!',
    Data =>"How's it goin', eh?"
    );

    Create a simple message containing just an image
    $msg = MIME::Lite->new(
    From =>'me@myhost.com',
    To =>'you@yourhost.com',
    Cc =>'some@other.com, [email]some@more.com[/email]',
    Subject =>'Helloooooo, nurse!',
    Type =>'image/gif',
    Encoding =>'base64',
    Path =>'hellonurse.gif'
    );

    Create a multipart message
    ### Create the multipart "container":
    $msg = MIME::Lite->new(
    From =>'me@myhost.com',
    To =>'you@yourhost.com',
    Cc =>'some@other.com, [email]some@more.com[/email]',
    Subject =>'A message with 2 parts...',
    Type =>'multipart/mixed'
    );

    ### Add the text message part:
    ### (Note that "attach" has same arguments as "new"):
    $msg->attach(Type =>'TEXT',
    Data =>"Here's the GIF file you wanted"
    );

    ### Add the image part:
    $msg->attach(Type =>'image/gif',
    Path =>'aaa000123.gif',
    Filename =>'logo.gif',
    Disposition => 'attachment'
    );

    Paul Kraus Guest

  4. #3

    Default RE: SMTP From field using MIME::Lite

    I want to be able to add a display name as well. For example: Paul
    Harwood instead of the SMTP address.


    > I wrote the following code:
    >
    > MIME::Lite->send('smtp', "mail.myserver.com", Timeout=>60);
    >
    > $msg = MIME::Lite->new(
    > From =>"administrator\@myserver.com",
    > To =>'user@company.org',
    >
    > Subject =>"TEST",
    > Data =>"TEST",
    >
    > );
    >
    > $msg->send;
    >
    >
    > I want to have a display name present in the "From" field. In
    > other words, I would like the 'From' field to read:
    Your code is correct. I would write the from as
    'administrator@myserver.com' to avoid esaping the @.
    What do you get back when this is sent? This is a text only message
    correct?

    Here are some examples from the docs...

    Create a simple message containing just text
    $msg = MIME::Lite->new(
    From =>'me@myhost.com',
    To =>'you@yourhost.com',
    Cc =>'some@other.com, [email]some@more.com[/email]',
    Subject =>'Helloooooo, nurse!',
    Data =>"How's it goin', eh?"
    );

    Create a simple message containing just an image
    $msg = MIME::Lite->new(
    From =>'me@myhost.com',
    To =>'you@yourhost.com',
    Cc =>'some@other.com, [email]some@more.com[/email]',
    Subject =>'Helloooooo, nurse!',
    Type =>'image/gif',
    Encoding =>'base64',
    Path =>'hellonurse.gif'
    );

    Create a multipart message
    ### Create the multipart "container":
    $msg = MIME::Lite->new(
    From =>'me@myhost.com',
    To =>'you@yourhost.com',
    Cc =>'some@other.com, [email]some@more.com[/email]',
    Subject =>'A message with 2 parts...',
    Type =>'multipart/mixed'
    );

    ### Add the text message part:
    ### (Note that "attach" has same arguments as "new"):
    $msg->attach(Type =>'TEXT',
    Data =>"Here's the GIF file you wanted"
    );

    ### Add the image part:
    $msg->attach(Type =>'image/gif',
    Path =>'aaa000123.gif',
    Filename =>'logo.gif',
    Disposition => 'attachment'
    );


    Paul Harwood Guest

  5. #4

    Default Re: SMTP From field using MIME::Lite

    This code works for me
    -----
    #!/usr/bin/perl

    use strict;
    use warnings;
    use MIME::Lite;

    my $msg = MIME::Lite->new(
    From => '"Paul Kraus" [email]pkraus@pelsupply.com[/email]',
    To => 'pkraus@pelsupply.com',
    Subject => 'RE:SMTP From field using MIME::Lite - Test Send',
    Data => 'This message sent with mime lite'
    );
    MIME::Lite -> send ('smtp','my.mailserver.com' );
    $msg -> send;
    Paul Kraus Guest

  6. #5

    Default RE: SMTP From field using MIME::Lite

    It might be my mail server settings. I am using Exchange Server 2003.


    SMTP MAIL command failed:
    5.5.4 Invalid Address

    I will check into this more.

    -----Original Message-----
    From: Paul Kraus [mailto:pkraus@pelsupply.com]
    Sent: Tuesday, December 09, 2003 4:21 PM
    To: Paul Harwood; Beginner Perl
    Subject: Re: SMTP From field using MIME::Lite

    This code works for me
    -----
    #!/usr/bin/perl

    use strict;
    use warnings;
    use MIME::Lite;

    my $msg = MIME::Lite->new(
    From => '"Paul Kraus" [email]pkraus@pelsupply.com[/email]',
    To => 'pkraus@pelsupply.com',
    Subject => 'RE:SMTP From field using
    MIME::Lite - Test Send',
    Data => 'This message sent with mime lite'
    );
    MIME::Lite -> send ('smtp','my.mailserver.com' );
    $msg -> send;

    Paul Harwood Guest

  7. #6

    Default Re: SMTP From field using MIME::Lite

    i would like someone to help me with SMTP please i will be glad thanks and here is my Email address :: john.hampton11@ymail.com
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139