hi..
I have a text file contain some info as below:-
isp:/home/ftpadmin # more email.txt
baharin.hasan@gmail.com;/tmp/hisyam/test.txt;BAHARIN HASAN;12345;RM101
+.99;12/12/2010;12/1/2011
asmah@impressivecomm.com;/tmp/hisyam/test.txt;ASMAH AHMAD;12345;RM111.
+99;12/12/2010;12/1/2011
hisham@impressivecomm.com;/tmp/hisyam/test.txt;HISHAM SALLEH;12345;RM2
+01.99;12/12/2010;12/1/2011
Based on my program, i want all the information from the input data and send email using MIME::Lite. But my code look failed and it was not send the email.. WHY ?...please help me.. is there any missing on my code </code>
#!/usr/bin/perl
use MIME::Lite;
open (DATA, "/home/ftpadmin/email.txt");
open (LOG, ">> /root/bin/email.log");
while (my $line = <DATA>) {
chomp($line);
my ($id,$attach,$name,$acc_no,$amount,$sdate,$ddate) = split(/
+;/,$line);
print (LOG localtime . ",$id,$attach,$name,$acc_no,$amount,$sd
+ate,$ddate\n");
$msg = MIME::Lite->new(
To =>'$id',
From =>'"DATAONE SDN BHD"<admin@dataone.asia>',
Subject =>'TEST ON $sdate',
Type =>'multipart/related'
);
$msg->attach(
Type => 'text/html',
Data => qq{
<head>
<title>TEST ON $sdate</title>
</head>
<body>
<center>
<table border=0>
<tr>
<th><img border=0 src=/images/pulpit.jpg alt=Pulpit rock w
+idth=67 height=92 /></th>
<th><p> </p>
<h2>Bill Statement</h2></th>
</tr>
<tr>
<td><h4>Dear $name,</h4>
<p>Thank you for your valued subscription to our<br/>
services.Your TM bill statement is now attached as <br/>
an Adobe PDF file in this email.</p>
<p>Thank You</p></td>
<td><p>Account No.</p><p>$account</p>Statement Date.<p>12/
+12/2010</p></td>
</tr>
</table>
<center><img src=example.jpg alt=example/></center>
</center>
</body>
},
);
$msg->attach(
Type => 'image/gif',
Id => 'image.gif',
Path => '/tmp/image.gif',
);
$msg->send();
}
close(DATA);
close(LOG);
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.