<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sending mail and attachments from Perl using NET::SMTP</title>
	<atom:link href="http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/feed/" rel="self" type="application/rss+xml" />
	<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 14:19:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=483</generator>
	<item>
		<title>By: abhinay</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-15318</link>
		<dc:creator>abhinay</dc:creator>
		<pubDate>Fri, 03 Feb 2012 21:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-15318</guid>
		<description>i am getting below error while executing the above Perl script

[/home/abc/cde/mnd] s-t$ test.pl
Scalar found where operator expected at test.pl line 25, near &quot;&quot;Content-type: multipart/mixed;ntboundary=&quot;$boundary&quot;
        (Missing operator before $boundary?)
String found where operator expected at test.pl line 25, near &quot;$boundary&quot;n&quot;&quot;
        (Missing operator before &quot;n&quot;?)
Scalar found where operator expected at test.pl line 32, near &quot;&quot;Content-Type: application/text; name=&quot;$attachFile&quot;
        (Missing operator before $attachFile?)
String found where operator expected at test.pl line 32, near &quot;$attachFile&quot;n&quot;&quot;
        (Missing operator before &quot;n&quot;?)
Scalar found where operator expected at test.pl line 33, near &quot;&quot;Content-Disposition: attachment; filename=&quot;$attachFile&quot;
        (Missing operator before $attachFile?)
String found where operator expected at test.pl line 33, near &quot;$attachFile&quot;n&quot;&quot;
        (Missing operator before &quot;n&quot;?)
Possible unintended interpolation of @csvn in string at test.pl line 35.
syntax error at test.pl line 25, near &quot;&quot;Content-type: multipart/mixed;ntboundary=&quot;$boundary&quot;
Global symbol &quot;$boundaryn&quot; requires explicit package name at test.pl line 27.
Global symbol &quot;$boundaryn&quot; requires explicit package name at test.pl line 31.
syntax error at test.pl line 32, near &quot;&quot;Content-Type: application/text; name=&quot;$attachFile&quot;
syntax error at test.pl line 33, near &quot;&quot;Content-Disposition: attachment; filename=&quot;$attachFile&quot;
Global symbol &quot;@csvn&quot; requires explicit package name at test.pl line 35.
Bareword &quot;DATA&quot; not allowed while &quot;strict subs&quot; in use at test.pl line 15.
Execution of test.pl aborted due to compilation errors.</description>
		<content:encoded><![CDATA[<p>i am getting below error while executing the above Perl script</p>
<p>[/home/abc/cde/mnd] s-t$ test.pl<br />
Scalar found where operator expected at test.pl line 25, near &#8220;&#8221;Content-type: multipart/mixed;ntboundary=&#8221;$boundary&#8221;<br />
        (Missing operator before $boundary?)<br />
String found where operator expected at test.pl line 25, near &#8220;$boundary&#8221;n&#8221;"<br />
        (Missing operator before &#8220;n&#8221;?)<br />
Scalar found where operator expected at test.pl line 32, near &#8220;&#8221;Content-Type: application/text; name=&#8221;$attachFile&#8221;<br />
        (Missing operator before $attachFile?)<br />
String found where operator expected at test.pl line 32, near &#8220;$attachFile&#8221;n&#8221;"<br />
        (Missing operator before &#8220;n&#8221;?)<br />
Scalar found where operator expected at test.pl line 33, near &#8220;&#8221;Content-Disposition: attachment; filename=&#8221;$attachFile&#8221;<br />
        (Missing operator before $attachFile?)<br />
String found where operator expected at test.pl line 33, near &#8220;$attachFile&#8221;n&#8221;"<br />
        (Missing operator before &#8220;n&#8221;?)<br />
Possible unintended interpolation of @csvn in string at test.pl line 35.<br />
syntax error at test.pl line 25, near &#8220;&#8221;Content-type: multipart/mixed;ntboundary=&#8221;$boundary&#8221;<br />
Global symbol &#8220;$boundaryn&#8221; requires explicit package name at test.pl line 27.<br />
Global symbol &#8220;$boundaryn&#8221; requires explicit package name at test.pl line 31.<br />
syntax error at test.pl line 32, near &#8220;&#8221;Content-Type: application/text; name=&#8221;$attachFile&#8221;<br />
syntax error at test.pl line 33, near &#8220;&#8221;Content-Disposition: attachment; filename=&#8221;$attachFile&#8221;<br />
Global symbol &#8220;@csvn&#8221; requires explicit package name at test.pl line 35.<br />
Bareword &#8220;DATA&#8221; not allowed while &#8220;strict subs&#8221; in use at test.pl line 15.<br />
Execution of test.pl aborted due to compilation errors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Franky</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-7574</link>
		<dc:creator>Franky</dc:creator>
		<pubDate>Thu, 08 Dec 2011 12:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-7574</guid>
		<description>For the Bare word error, use
@csv = &lt;&gt;

this stipulates that the Filehandle, DATA be read into @csv.</description>
		<content:encoded><![CDATA[<p>For the Bare word error, use<br />
@csv = &lt;&gt;</p>
<p>this stipulates that the Filehandle, DATA be read into @csv.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Franky</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-7573</link>
		<dc:creator>Franky</dc:creator>
		<pubDate>Thu, 08 Dec 2011 12:42:31 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-7573</guid>
		<description>strange... but i put anglebrackets each side of DATA but now cant see them on the website

\&lt;
&lt;&gt;</description>
		<content:encoded><![CDATA[<p>strange&#8230; but i put anglebrackets each side of DATA but now cant see them on the website</p>
<p>\&lt;<br />
&lt;&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Franky</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-7571</link>
		<dc:creator>Franky</dc:creator>
		<pubDate>Thu, 08 Dec 2011 12:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-7571</guid>
		<description>For the Bare word error,  use
@csv = 

this stipulates that the Filehandle, DATA be read into @csv.</description>
		<content:encoded><![CDATA[<p>For the Bare word error,  use<br />
@csv = </p>
<p>this stipulates that the Filehandle, DATA be read into @csv.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chirag Shah</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-6642</link>
		<dc:creator>Chirag Shah</dc:creator>
		<pubDate>Fri, 28 Oct 2011 13:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-6642</guid>
		<description>Hey Larry,

Thanks for upload. I wanted to send multiple attachments instead. What modifications are needed.

Thanks,
Chirag</description>
		<content:encoded><![CDATA[<p>Hey Larry,</p>
<p>Thanks for upload. I wanted to send multiple attachments instead. What modifications are needed.</p>
<p>Thanks,<br />
Chirag</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chandler</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-6306</link>
		<dc:creator>chandler</dc:creator>
		<pubDate>Fri, 29 Jul 2011 19:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-6306</guid>
		<description>actually after a couple of modifications (both to $data_file = $attachment, and to removing the sub routine) i am getting the following error only:

syntax error at fullRiskEmail.pl line 29, near &quot;= ;&quot;
Exectution of fullRiskEmail.pl aborted due to complilation errors

I have also tried with @csv = DATA;
and i get the following error:
Barework &quot;DATA&quot; not allowed while &quot;strict subs&quot; in use at fullRiskEmail.pl line 29

Thanks again</description>
		<content:encoded><![CDATA[<p>actually after a couple of modifications (both to $data_file = $attachment, and to removing the sub routine) i am getting the following error only:</p>
<p>syntax error at fullRiskEmail.pl line 29, near &#8220;= ;&#8221;<br />
Exectution of fullRiskEmail.pl aborted due to complilation errors</p>
<p>I have also tried with @csv = DATA;<br />
and i get the following error:<br />
Barework &#8220;DATA&#8221; not allowed while &#8220;strict subs&#8221; in use at fullRiskEmail.pl line 29</p>
<p>Thanks again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chandler</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-6305</link>
		<dc:creator>chandler</dc:creator>
		<pubDate>Fri, 29 Jul 2011 18:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-6305</guid>
		<description>larry, thanks a ton. your code has been super helpful.
my issue is that i am getting errors from what seems to be the data from the .xls being passed through for the attachment.

Here is the code that i am using:
open(DATA, $data_file) &#124;&#124; die(&quot;Could not open the file&quot;);
my @csv = ;
close(DATA);


sendEmail();

sub sendEmail()
{
	my $msgPrefix = &quot;Attached is the full Risk Report\n\n&quot;;
	my $msgSuffix = &quot;\nIf you no longer need the full report daily, please let me know.&quot;;
	
	my $smtp = Net::SMTP-&gt;new($smtpServer) or die &quot;The error is: $!&quot;;
	
	$smtp-&gt;mail($fromEmail);
#	$smtp-&gt;to($toEmail1);
	$smtp-&gt;to($toEmail2);
	$smtp-&gt;data();
	
#	$smtp-&gt;datasend(&quot;To: $toEmail1\n&quot;);
	$smtp-&gt;datasend(&quot;To: $toEmail2\n&quot;);
	$smtp-&gt;datasend(&quot;Subject: Full Risk Report\n&quot;);
	
	$smtp-&gt;datasend(&quot;MIME-Version: 1.0\n&quot;);
	
#	$smtp-&gt;datasend(&quot;Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ntboundary=&quot;$boundary&quot;n&quot;);

	$smtp-&gt;datasend(&quot;Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; name=&quot; . $attachment);
	$smtp-&gt;datasend(&quot;\n&quot;);
	$smtp-&gt;datasend(&quot;--$boundary\n&quot;);
	$smtp-&gt;datasend(&quot;Content-type: text/plain\n&quot;);
	$smtp-&gt;datasend(&quot;Content-Disposition: quoted-printable\n&quot;);
	$smtp-&gt;datasend(&quot;\nTest From Youn&quot;);
	$smtp-&gt;datasend(&quot;--$boundary\n&quot;);
#	$smtp-&gt;datasend(&quot;Content-Type: application/text; name=\&quot;$attachment\&quot;\n&quot;);
#	$smtp-&gt;datasend(&quot;Content-Disposition: attachment; filename=\&quot;$attachment\&quot;\n&quot;);
	$smtp-&gt;datasend(&quot;Content-Disposition: attachment; filename=&quot; . $attachment . &quot;\n&quot;);
	$smtp-&gt;datasend(&quot;\n&quot;);
	$smtp-&gt;datasend(&quot;@csv\n&quot;);
	$smtp-&gt;datasend(&quot;--$boundary--\n&quot;);


#	$smtp-&gt;datasend(&quot;Content-Disposition: attachment; filename=&quot; . $attachment . &quot;\n&quot;);
#	$smtp-&gt;datasend(&quot;Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; name=&quot; . $attachment);

	$smtp-&gt;datasend($msgPrefix . $_[0] . $msgSuffix);
	$smtp-&gt;dataend();
	$smtp-&gt;quit;
}
exit;

---------------------------------------------------------------

Here are the errors:

Unrecognized escape \d passed through at fullRiskEmail.pl line 19
Unrecognized escape \M passed through at fullRiskEmail.pl line 19
unrecognized escape \R passed through at fullRiskEmail.pl line 19
main::sendEmail() called too early to check prototype at fulRiskEmail.pl line 25
syntax error at fullRiskEmail.pl line 21, near &quot;= ;&quot;
Execution of fullRiskEmail.pl aborted due to complation errors



*******************************

thanks larry</description>
		<content:encoded><![CDATA[<p>larry, thanks a ton. your code has been super helpful.<br />
my issue is that i am getting errors from what seems to be the data from the .xls being passed through for the attachment.</p>
<p>Here is the code that i am using:<br />
open(DATA, $data_file) || die(&#8220;Could not open the file&#8221;);<br />
my @csv = ;<br />
close(DATA);</p>
<p>sendEmail();</p>
<p>sub sendEmail()<br />
{<br />
	my $msgPrefix = &#8220;Attached is the full Risk Report\n\n&#8221;;<br />
	my $msgSuffix = &#8220;\nIf you no longer need the full report daily, please let me know.&#8221;;</p>
<p>	my $smtp = Net::SMTP-&gt;new($smtpServer) or die &#8220;The error is: $!&#8221;;</p>
<p>	$smtp-&gt;mail($fromEmail);<br />
#	$smtp-&gt;to($toEmail1);<br />
	$smtp-&gt;to($toEmail2);<br />
	$smtp-&gt;data();</p>
<p>#	$smtp-&gt;datasend(&#8220;To: $toEmail1\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;To: $toEmail2\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;Subject: Full Risk Report\n&#8221;);</p>
<p>	$smtp-&gt;datasend(&#8220;MIME-Version: 1.0\n&#8221;);</p>
<p>#	$smtp-&gt;datasend(&#8220;Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ntboundary=&#8221;$boundary&#8221;n&#8221;);</p>
<p>	$smtp-&gt;datasend(&#8220;Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; name=&#8221; . $attachment);<br />
	$smtp-&gt;datasend(&#8220;\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;&#8211;$boundary\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;Content-type: text/plain\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;Content-Disposition: quoted-printable\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;\nTest From Youn&#8221;);<br />
	$smtp-&gt;datasend(&#8220;&#8211;$boundary\n&#8221;);<br />
#	$smtp-&gt;datasend(&#8220;Content-Type: application/text; name=\&#8221;$attachment\&#8221;\n&#8221;);<br />
#	$smtp-&gt;datasend(&#8220;Content-Disposition: attachment; filename=\&#8221;$attachment\&#8221;\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;Content-Disposition: attachment; filename=&#8221; . $attachment . &#8220;\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;@csv\n&#8221;);<br />
	$smtp-&gt;datasend(&#8220;&#8211;$boundary&#8211;\n&#8221;);</p>
<p>#	$smtp-&gt;datasend(&#8220;Content-Disposition: attachment; filename=&#8221; . $attachment . &#8220;\n&#8221;);<br />
#	$smtp-&gt;datasend(&#8220;Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; name=&#8221; . $attachment);</p>
<p>	$smtp-&gt;datasend($msgPrefix . $_[0] . $msgSuffix);<br />
	$smtp-&gt;dataend();<br />
	$smtp-&gt;quit;<br />
}<br />
exit;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Here are the errors:</p>
<p>Unrecognized escape \d passed through at fullRiskEmail.pl line 19<br />
Unrecognized escape \M passed through at fullRiskEmail.pl line 19<br />
unrecognized escape \R passed through at fullRiskEmail.pl line 19<br />
main::sendEmail() called too early to check prototype at fulRiskEmail.pl line 25<br />
syntax error at fullRiskEmail.pl line 21, near &#8220;= ;&#8221;<br />
Execution of fullRiskEmail.pl aborted due to complation errors</p>
<p>*******************************</p>
<p>thanks larry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larry</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-5851</link>
		<dc:creator>larry</dc:creator>
		<pubDate>Fri, 08 Apr 2011 11:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-5851</guid>
		<description>I would imagine that you&#039;d need to stream the code into the buffer to send it but I&#039;ve not done this myself.</description>
		<content:encoded><![CDATA[<p>I would imagine that you&#8217;d need to stream the code into the buffer to send it but I&#8217;ve not done this myself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Diego</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-5828</link>
		<dc:creator>Diego</dc:creator>
		<pubDate>Mon, 04 Apr 2011 14:53:40 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-5828</guid>
		<description>How can I send a video using this code? I could only send txt files. I tried the mime type video/x-msvideo but didn&#039;t work...Is it possible to use the same code as
open (DATA, “$data_file”) &#124;&#124; die(“Could not open the file”);
my @txt = ;
close DATA;

Actually I couldn&#039;t compile the above code and changed to
open (DATA, “$data_file”) &#124;&#124; die(“Could not open the file”);
my @avi = ;
close DATA;

Thanks</description>
		<content:encoded><![CDATA[<p>How can I send a video using this code? I could only send txt files. I tried the mime type video/x-msvideo but didn&#8217;t work&#8230;Is it possible to use the same code as<br />
open (DATA, “$data_file”) || die(“Could not open the file”);<br />
my @txt = ;<br />
close DATA;</p>
<p>Actually I couldn&#8217;t compile the above code and changed to<br />
open (DATA, “$data_file”) || die(“Could not open the file”);<br />
my @avi = ;<br />
close DATA;</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Udita</title>
		<link>http://luckylarry.co.uk/programming-tutorials/perl/sending-mail-and-attachments-from-perl-using-netsmtp/comment-page-1/#comment-5671</link>
		<dc:creator>Udita</dc:creator>
		<pubDate>Thu, 24 Feb 2011 13:13:49 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=255#comment-5671</guid>
		<description>Hi,
Thanks for the code for such a useful topic.

I used this code for sending a mail with an .txt attachment, However data of the .txt file directly printed in the mail body, there is no attachment in the mail.

I need to send the mail with attchment.

Kindly help me.

Thanks</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thanks for the code for such a useful topic.</p>
<p>I used this code for sending a mail with an .txt attachment, However data of the .txt file directly printed in the mail body, there is no attachment in the mail.</p>
<p>I need to send the mail with attchment.</p>
<p>Kindly help me.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

