SDP Logo
Attributes
Narrative
Quest
- - -
Motley

 

Copyright/Credits
SDP

Scott Dustin Penrose's Homepage

QUEST

A search for an alternative that meets cognitive criteria

-
-
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Entity;
use Net::SMTP;
use MIME::Types;
my $mimetypes = MIME::Types->new;

my $from = 'rt@somewhere.com.au';
my $to = 'rt-comment@somewhere.com.au';

# Get File and RT details
my $raw = shift;
die "No filename provided" unless (-f $raw);
unless ($raw =~ /^(\d+)(.+)$/) {
	die "Not a valid filename";
}
my $rt = $1;
my $filename = $2;

print "Sending $filename to job $rt\n";

# Create MIME Entry
my $mime = MIME::Entity->build(
	From => $from,
	To => $to,
	Subject => "[somewhere.com.au #$rt] Resubmit Attachment",
	Data => "Resubmit attachment\n",
);

$mime->attach(
	Path => $raw,
	Type => ($mimetypes->mimeTypeOf($raw) || "application/octent-stream"),
	Encoding => '-SUGGEST',
);


# SEND Mail
my $smtp = Net::SMTP->new('mail.somewhere.com.au');

$smtp->mail($from);
$smtp->to($to);

$smtp->data();
$smtp->datasend($mime->stringify);
$smtp->dataend();

$smtp->quit;



syntax highlighted by Code2HTML, v. 0.9.1