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     =>"[EMAIL PROTECTED]",
>                      To       =>'[EMAIL PROTECTED]',          
>         
>                      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
'[EMAIL PROTECTED]' 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     =>'[EMAIL PROTECTED]',
                     To       =>'[EMAIL PROTECTED]',
                     Cc       =>'[EMAIL PROTECTED], [EMAIL PROTECTED]',
                     Subject  =>'Helloooooo, nurse!',
                     Data     =>"How's it goin', eh?"
                     );

  Create a simple message containing just an image
        $msg = MIME::Lite->new(
                     From     =>'[EMAIL PROTECTED]',
                     To       =>'[EMAIL PROTECTED]',
                     Cc       =>'[EMAIL PROTECTED], [EMAIL PROTECTED]',
                     Subject  =>'Helloooooo, nurse!',
                     Type     =>'image/gif',
                     Encoding =>'base64',
                     Path     =>'hellonurse.gif'
                     );

  Create a multipart message
        ### Create the multipart "container":
        $msg = MIME::Lite->new(
                     From    =>'[EMAIL PROTECTED]',
                     To      =>'[EMAIL PROTECTED]',
                     Cc      =>'[EMAIL PROTECTED], [EMAIL PROTECTED]',
                     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'
                     );

Reply via email to