Hi there Monks!
All I am trying to do here is to send an HTML email, but I cant see where the problem is that no email gets sent. Here is some of the code I am using:
#!/usr/bin/perl use strict; use warnings; use autodie qw(open close); use CGI qw(-oldstyle_urls :standard); use CGI::Carp qw(fatalsToBrowser); use MIME::Lite; use POSIX qw/strftime/; my $date = strftime "%m/%d/%Y", localtime; print header(); send_reg_email( first_name => 'Joe', last_name => 'Doe', ); sub send_reg_email { my (%args) = @_; my $first_name = $args{first_name} || ''; my $last_name = $args{last_name} || ''; my $e_from = 'Form Registration <myemail@test.com>'; my $e_to = 'Form Support <myemail@test.com>'; my $msg = MIME::Lite->new( From => $e_from, To => $e_to, Subject => "Registration", Type => 'multipart/related') or die "Error Creating Message +: $!\n"; $msg->attach( Type => 'text/html', Data => qq| <html> <head> <meta http-equiv="Content-language" content="en-gb" /> <title>Registration Email</title> <style type="text/css"> html { margin:0; padding:0; } body { padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; font-family:arial,helvetica; font-size: 14px; color:#808080; } .etext { font-family:arial,helvetica; font-size: 14px; color:#A1A1A1; } </style> </head> <body bgcolor="#1A1A1A"> <table width="100%" border="0" bgcolor="#1A1A1A" cellpaddin +g="0" cellspacing="0"> <tr> <td bgcolor="#1A1A1A" width="100%"> <table width="100%" border="1" bgcolor="#1A1A1A" cellp +adding="0" cellspacing="0"> <tr> <td bgcolor="#1A1A1A" width="125" height="47"><im +g src="cid:logo" width="212" height="98" border="0" /> </td> </tr> </table> </td> </tr> <tr> <td align="left"> <table width="100%" border="0" bgcolor="#1A1A1A" cell +padding="0" cellspacing="0"> <tr> <td bgcolor="#1A1A1A" width="100%" height="" align +="left">&nbsp;</td> </tr> <tr> <td bgcolor="#1A1A1A" width="100%" height="" align +="left"><div class="etext">&nbsp;&nbsp;<font color="#A1A1A1">Registra +tion Information</font></div></td> </tr> <tr> <td bgcolor="#1A1A1A" width="100%" height="" align +="left">&nbsp;</td> </tr> <tr> <td bgcolor="#1A1A1A" width="100%" height="" align +="left"><div class="etext">&nbsp;&nbsp;<font color="#A1A1A1">Name: $f +irst_name $last_name</font></div></td> </tr> <tr> <td bgcolor="#1A1A1A" width="100%" height="" align +="left">&nbsp;</td> </tr> <tr> <td bgcolor="#1A1A1A" width="100%" height="" align +="left">&nbsp;</td> </tr> </table> </td> </tr> <tr> <td align="left">&nbsp;</td> </tr> </table> </body> </html> |, ); # Attach GIF image $msg->attach( Type => 'image/png', Id => 'logo', Encoding => 'base64', Path => '../images/logo.png'); $msg->send(); } # end mail sub print "<br>DONE<br>";
Thanks for looking!

In reply to Sending email Help! by Anonymous Monk

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.