$msgHTML .= "</FONT></BODY></HTML>"; my %mail; if ($product_row->{'ProductName'} eq "Company1"){ $mail{'subject'} = sprintf("Second Order Confirmation - Order Numb +er %s", $ordernum); $mail{'from'} = "Second Automatic Order Processor <orders\@mysite. +com>"; } else { $mail{'subject'} = sprintf("First Order Confirmation - Order Numbe +r %s", $ordernum); $mail{'from'} = "First Order Processor <orders\@mysite.com>"; } if ($bTestMode) { $mail{'to'} = 'myemail@address.com'; } else { my $deliveryEmail = param('reseller'); # if this is not null, deli +very will redirect to this email address if ($deliveryEmail) { $mail{'to'} = $deliveryEmail; $mail{'cc'} = 'myemail@mysite.com'; } else { $mail{'to'} = 'myemail@mysite.com,myemail@mysite.com'; } } $mail{'smtp'} = 'mail.mysite.com'; my $mimeMail; $mimeMail = MIME::Lite->new(From => $mail{'from'}, To => $mail{'to'}, Subject => $mail{'subject'}, Type => 'multipart/related', AuthUser=> 'user', AuthPass=> 'password'); my $both_parts = MIME::Lite->new( Type => "multipart/alternative", Data => $msgtxt, ); my $text_part = MIME::Lite->new( Type => "text/plain", Data => $msgtxt, ); my $html_part = MIME::Lite->new( Type => 'text/html', Data => $msgHTML); $both_parts->attach($text_part); $both_parts->attach($html_part); if ($product_row->{'ProductName'} eq "Company1"){ $mimeMail ->attach($both_parts); $mimeMail->attach( Encoding => 'base64', Type => 'image/jpeg', Path => './logo.jpg', Id => 'logo.jpg', Disposition => 'inline' ); } if ($product_row->{'ProductName'} ne "Company2"){ $mimeMail ->attach($both_parts); $mimeMail->attach( Encoding => 'base64', Type => 'image/jpeg', Path => './logo.jpg', Id => 'logo.jpg', Disposition => 'inline' ); } $mimeMail->send; print end_html; $dbh1->disconnect; $dbh2->disconnect; $dbh3->disconnect; sub uncommify { if ($_[0] eq "") { return "0"; } my $newstr = $_[0]; $newstr =~ s/,//g; return $newstr; } sub commify { if ($_[0] eq "") { return "0"; } my $text = reverse uncommify($_[0]); $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; } }
In reply to Need to send two simultaneous mails by salope
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |