[rt-users] Attachments

Matthew Keller kellermg at potsdam.edu
Wed Mar 28 10:53:50 EDT 2007


Here's a code snippet of a function I wrote to abstract sending e-mail
with attachments. If you read the perldoc for Mail::Sender, it talks
about attaching multiple files, etc.

sub Send_Email{
	use Mail::Sender;
	my ($to, $from, $subject, $message, $attach) = @_;
	my $sender = new Mail::Sender{
		smtp => '127.0.0.1',
		from => $from
	};
	unless($sender) { die "Send_email said $sender: $Mail::Sender::Error
\n"; }
	
	my $mf=$sender-> MailFile({
		to => $to,
		subject => $subject,
		msg => $message,
		file => $attach
			   }); 
			   
	unless($mf) { die "Send_email mailfile said $mf: $Mail::Sender::Error
\n"; }
	
}


On Wed, 2007-03-28 at 10:22 -0400, Matthew Keller wrote:
> Yeah, I have a number of webforms that use attachments. They all send
> e-mail (with file attached) to the rt e-mail gateway, and it
> disassembles the attachments and adds them properly to the ticket.
> 
> On Wed, 2007-03-28 at 15:13 +0100, John Paul Hayes wrote:
> > Hi All,
> > 
> > I'm currently developing a form which performs some basic ticket
> > manipulations 
> > eg,  set priority, due date etc...
> > Now the requirement to add attachments has arisen on this form.
> > 
> > I've searched the archives for relevant information on this but I
> > cannot find any. 
> > So hence this post.
> > 
> > Has anybody developed such a form with this functionality before? 
> > If so, would they be kind enought to point me in the right direction.
> > 
> > Thank you in advance,
> > Jp
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> > 
> > Community help: http://wiki.bestpractical.com
> > Commercial support: sales at bestpractical.com
> > 
> > 
> > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> > Buy a copy at http://rtbook.bestpractical.com
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com




More information about the rt-users mailing list