Dear Monks:
sub sendmail { my $server = 'emailserver.com'; my $from = 'myemail@emailserver.com'; my $disguise = 'mygmail@gmail.com'; my $to = $_[0]; my $subject = $_[1]; my $body = $_[2]; use MIME::Lite; my $msg; $msg = MIME::Lite -> new( From => $from, To => $to, CC => $from, Subject => $subject, Type => 'text/html', Data => qq{$body} ); if(not $msg ->send('smtp', $server, Timeout => 60, Debug => 1)){ die "Can not send the message.\n"; } }
How can I disguise the sender's email address with MIME::Lite?

I am trying to let the email recipient see my mygmail@gmail.com as the sender' address instead of the myemail@emailserver.com who sends the email. I have to use myemail@emailserver.com in the "From" because the emailserver.com requires the sender's email must be in the server's private list.

I know I can disguise it using Net::SMTP easily, but Net::SMTP does not support html email as far as I know.

Disclaimer: I'm not trying to spam anybody using email. I just need to use this function so that recipient can reply to the right email address.

Any help will be appreciated!


In reply to How to disguise sender's email address with MIME::Lite? by neverminda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.