[Xitami] [Xitami]Attachments to E-mail?

xitami@lists.xitami.org
Thu, 25 Apr 2002 10:19:34 -0700


------=_NextPart_84815C5ABAF209EF376268C8
Content-type: text/plain; charset=US-ASCII


 

Question on Attachments to E-mail:

 

Used Net::SMTP from ActiveState to set up sub to send mail.
This 
subroutine works correctly, but doesn't provide for
file attachments. Listed 
SMTP.pm and found entry points
for mail, to, data, and quit, but none for 
attach.

 

Do I need to use another module or can Net::SMTP be 
used?
 
Also, is there a module available for faxing files?

 

Listed below is the sub I'm using.

 

sub send_mail
{ my ($to, $from, $subject, @body, $attach)=@_;
  
use Net::SMTP;

 

  my $relay = "smtp.earthlink.net";
  my $smtp  = 
Net::SMTP- new($relay);
  die "Open of mail failed" if (! defined 
$smtp);
  print "Open of mail OK", " BR ";

 

  print "Mail beg", " BR ";
  
$smtp- mail($from);
  $smtp- to($to);
  
$smtp- data();
  $smtp- datasend("To: $to\n");
  
$smtp- datasend("From: $from\n");
  $smtp- datasend("Subject: 
$subject\n");
  $smtp- datasend("\n");
  
foreach(@body)
  {
    
$smtp- datasend("$_\n");
  }
  
$smtp- dataend("\n");
  $smtp- quit;
}

 

--- Robert N Meehan 909 784 5908,  214573 

--- rmsoftware@earthlink.net 

--- EarthLink: It's your Internet.

------=_NextPart_84815C5ABAF209EF376268C8
Content-Type: text/html; charset=US-ASCII

<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
<META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>
<BODY>
<P>
<DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>Question on Attachments to E-mail:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Used Net::SMTP from ActiveState to set up sub to send mail.<BR>This subroutine works correctly, but doesn't provide for<BR>file attachments. Listed SMTP.pm and found entry points<BR>for mail, to, data, and quit, but none for attach.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Do I need to use another module or can Net::SMTP be used?<BR>&nbsp;<BR>Also, is there a module available for faxing files?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Listed below is the sub I'm using.</DIV>
<DIV>&nbsp;</DIV>
<DIV>sub send_mail<BR>{ my ($to, $from, $subject, @body, $attach)=@_;<BR>&nbsp; use Net::SMTP;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; my $relay = "smtp.earthlink.net";<BR>&nbsp; my $smtp&nbsp; = Net::SMTP-&gt;new($relay);<BR>&nbsp; die "Open of mail failed" if (! defined $smtp);<BR>&nbsp; print "Open of mail OK", "&lt;BR&gt;";</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; print "Mail beg", "&lt;BR&gt;";<BR>&nbsp; $smtp-&gt;mail($from);<BR>&nbsp; $smtp-&gt;to($to);<BR>&nbsp; $smtp-&gt;data();<BR>&nbsp; $smtp-&gt;datasend("To: $to\n");<BR>&nbsp; $smtp-&gt;datasend("From: $from\n");<BR>&nbsp; $smtp-&gt;datasend("Subject: $subject\n");<BR>&nbsp; $smtp-&gt;datasend("\n");<BR>&nbsp; foreach(@body)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; $smtp-&gt;datasend("$_\n");<BR>&nbsp; }<BR>&nbsp; $smtp-&gt;dataend("\n");<BR>&nbsp; $smtp-&gt;quit;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>---&nbsp;Robert N Meehan 909 784 5908, &nbsp;214573&nbsp;</DIV>
<DIV>--- <A href="mailto:rmsoftware@earthlink.net">rmsoftware@earthlink.net</A></DIV>
<DIV>--- EarthLink: It's your Internet.</DIV>
<DIV>&nbsp;</DIV>
<P></P></BODY></HTML>
------=_NextPart_84815C5ABAF209EF376268C8--