It is kind of sloppy but i just put the code into the onClick for the email
it is only for one person
sub OnClick {
my( $self, $event ) = @_;
if (my $rr = $self->{txt}->GetValue()) {
print $rr."\n";
my $local = 'C:\Users\xxx\Documents\Projects\remakes';
my $remote = '\\\\xx\\Fulfill\\Gavehren\\remakes';
my $localFile = $local . "\\" . $rr . "\.txt";
my $remoteFile = $remote . "\\" . $rr . "\.txt";
# save to a dir and put it local and remote
open (FH, "> $localFile");
print FH "$rr \n";
close FH;
open (REMOTE, "> $remoteFile");
print REMOTE "$rr \n";
close REMOTE;
my $msg = "\n";
my $emailSUBJ = "Card number ";
my @emailRECIPIENTS;
@emailRECIPIENTS = qw(xx@xx.com);
my $outlook = new Mail::Outlook();
my $message = $outlook->create();
if (my $rr = $self->{txt}->GetValue()) {
$msg .= " $rr\n";
$msg .= '\\jservdc01\Fulfill\Gavehren\remakes';
$message->Attach( $remoteFile );
}
$message->To('xx@xx.com');
$message->Subject('File');
$message->Body($msg);
$message->send;;
$self->SetTitle( 'Submitted' );
}else{
$self->SetTitle( 'Something went wrong' );
}
}
|