473,695 Members | 2,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mail:SendMail Troubleshooting

3 New Member
Hi I am new here and once upon a time I worked with Perl, now I am trying again and need some help:

I wrote a Perl script a few years ago that opened an order entry TXT file and sent each customer with an email address a confirmation email in html or txt. Simple enough and very effective.

Now I am editing this script to send a general email blast on a new computer... I have ActivePerl 5.10.0 Build 1003 installed. I downloaded Mail:Sendmail and put SendMail.pm in C:\Perl\lib\Mai l

First, I have a question about Perl and Mail:SendMail installation:

I am not sure that's all I have to do to install SendMail.pm right. For example, it doesn't show up in the Perl Package Manager from ActivePerl. If I view all packages and go to Mail:SendMail and select Install it warns me: WARNING: Installing Mail-Sendmail-0.79 would downgrade Mail::Sendmail from version 2.09 to 0.79

So I assume that the new version I dropped in lib\Mail 2.09 is installed.

???? right ????

I downloaded a trial version of Komodo IDE 4.4 to do my editing and debugging. Curious, what applications do people here recommend?

I made some edits to the script that basically remove the array looking for order details. My new email blast TXT is a simple tab delimited format: name (tab) email address (eol).

I am getting an error at the SendMail line. Here are some details...

Here's the opening of the file:

Expand|Select|Wrap|Line Numbers
  1. use strict; 
  2. use Fcntl; 
  3. use Data::Dumper; 
  4. use Mail::Sendmail; 
  5. use MIME::QuotedPrint; 
  6. use MIME::Base64; 
  7. use HTML::Entities; 
Here are the errors from the debugger:
Expand|Select|Wrap|Line Numbers
  1. > Ambiguous use of % resolved as operator % at C:\BasicEmailBlaster.pl line 183. 
  2.  
  3. > Bareword "sendmail" not allowed while "strict subs" in use at C:\BasicEmailBlaster.pl line 183. 
  4.  
  5. > Bareword "mail" not allowed while "strict subs" in use at C:\BasicEmailBlaster.pl line 183. 
  6.  
  7. > Execution of C:\BasicEmailBlaster.pl aborted due to compilation errors. 
Here is the Sub leading up to the Error - Error is on line 183 - the last line below:

Expand|Select|Wrap|Line Numbers
  1. sub SendEmail 
  2. my $bResult = 1; 
  3.  
  4. print "- SENDING CONFIRMATION EMAIL" . "\n"; 
  5.  
  6. my $MAILLOG; 
  7.  
  8. print "- Attempting Open: " . '>> '. $MailLogFile ."\n"; 
  9.  
  10. if ( ! open( MAILLOG, '>> '. $MailLogFile ) ) 
  11. print "Failed to open Email Log!\n"; 
  12. print "- Attempting Open: " . '>> '. $LogFile ."\n"; 
  13.  
  14. # log error message if not able to log email 
  15. &LogIt("Can't Log Email>>\nCan't Open:\t" . $MailLogFile); 
  16. undef $MAILLOG; 
  17. else 
  18. $MAILLOG = *MAILLOG; 
  19.  
  20. if ( defined $MAILLOG ) 
  21. {    
  22. print $MAILLOG (">> Mail Entry Start\n"); 
  23.  
  24. if ( !BuildEmail( \%mail ) ) 
  25. print "Building the Email Failed!\n"; 
  26. if ( defined $MAILLOG ) 
  27. {    
  28. print $MAILLOG (localtime( time ) . "\tBuilding the Email Failed!\n"); 
  29. &LogIt("Building the Email Failed!"); 
  30. $bResult = 0; 
  31. else 
  32. print "- Attempting Sendmail!\n"; 
  33.  
  34. 183     if (sendmail %mail) 
  35.  
  36. This is defining %mail
  37.  
  38. sub BuildEmail
  39. {
  40.     print "- BUILDING CONFIRMATION EMAIL" . "\n";
  41.  
  42.     my $OrderTxt = "";
  43.     my $OrderHtm = "";
  44.     for (my $i = 0; $i < 65; $i++)    
  45.     {
  46.         $OrderTxt.= $EmailArrayTxt[$i];
  47.         $OrderHtm.= $EmailArrayHtm[$i];
  48.     }
  49.  
  50.     my ($MailHash) = shift;
  51.     my %mail = %$MailHash;
  52.     my $boundary = "====" . time() . "====";
  53.  
  54.     $MailHash->{From}    = 'Me <me@none.com>';
  55.     $MailHash->{To}      = $To;
  56.     $MailHash->{Bcc}     = 'none@none.com';
  57.     $MailHash->{smtp}    = 'mail.mail.com';
  58.     $MailHash->{subject} = "Subjects";
  59.     $MailHash->{'content-type'} = "multipart/alternative; boundary=\"$boundary\"";
  60.  
  61.     local $/;                   # slurp mode (undef)
  62.     local *F;                   # create local filehandle
  63.  
  64.     my $filename = 'C:\EmailBlasts\EmailTemplates\EmailBlast.txt';
  65.  
  66.     print "- Opening $filename\n";
  67.     if ( !open(F, "<$filename") )
  68.     {
  69.         &LogIt("Can't Open:\t" . $filename);
  70.         return 0;    
  71.     }
  72.  
  73.     my $tempText = <F>;         # read whole file
  74.     close(F);                   # ignore retval
  75.  
  76.     $tempText =~ s/%%Order%%/$OrderTxt/eg;
  77.  
  78.     my $plain = encode_qp $tempText;
  79.  
  80.     my $filename = 'C:\EmailBlasts\EmailTemplates\EmailBlast.html';
  81.  
  82.     print "- Opening $filename\n";
  83.     if ( !open(F, "<$filename") )
  84.     {
  85.         &LogIt("Can't Open:\t" . $filename);
  86.         return 0;    
  87.     }
  88.  
  89.     my $tempText = <F>;            # read whole file
  90.     close(F);                   # ignore retval
  91.  
  92.     $tempText =~ s/%%Order%%/$OrderHtm/eg;
  93.  
  94.     my $html = encode_qp $tempText;
  95.  
  96.  
  97. $MailHash->{body} = <<END_OF_BODY;
  98. --$boundary
  99. Content-Type: text/plain; charset="iso-8859-1"
  100. Content-Transfer-Encoding: quoted-printable
  101.  
  102. $plain
  103.  
  104. --$boundary
  105. Content-Type: text/html; charset="iso-8859-1"
  106. Content-Transfer-Encoding: quoted-printable
  107.  
  108. $html
  109.  
  110. --$boundary--
  111. END_OF_BODY
  112.  
  113. }
  114.  
Any Ideas
Sep 4 '08 #1
3 3388
digitaldiva
3 New Member
Okay, I solved my problem by installing the Mail:SendMail 0.79 against PPMs advice. Now I need to add SMTP Authentication to my code. My new server authenticates, how do I do that?

Here's what I have now:

My settings:
Expand|Select|Wrap|Line Numbers
  1. $MailHash->{From} = '**@***.com'; 
  2. $MailHash->{To} = $To; 
  3. $MailHash->{Bcc} = '**@***.com'; 
  4. $MailHash->{smtp} = 'mail.mail.com'; 
  5. $MailHash->{subject} = "Newsletter"; 
  6. $MailHash->{'content-type'} = "multipart/alternative; boundary=\"$boundary\"";
Sep 4 '08 #2
KevinADC
4,059 Recognized Expert Specialist
As suggested on perlguru, you may need to switch to Net::SMTP. The module you are using does not appear to support authentication.
Sep 4 '08 #3
digitaldiva
3 New Member
aww you're everywhere. thanks.
Sep 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3035
by: CoralineSage | last post by:
Hi All, I'm running a bulleting board in PHP and everytime a new user registers s/he is supposed to receive an email confirmation. After filling out the registration form and clicking on submit I get the following error message: Fatal error: Call to undefined function: mail() in /usr/local/apache2/htdocs/ubbthreads/ubbt.inc.php on line 212
3
1531
by: Andrew McLean | last post by:
I am writing a CGI script on an account that only has Python 1.5.2. It's principal purpose is to take some user input from a form, do some manipulation and return some information to the user. However, I would also like it to send some information to an e-mail account (behind the scenes). The e-mail could be quite simple, but I wouldn't rule out wanting to send a pickled object or two. Now if I was using a recent Python I would just...
1
2079
by: murph | last post by:
Hi , I have created a little script that is running as daemon ( it is hard to say as daemon :)) ) . Then i try to send a mail and the mail is refused from sendmail. I have no idea why it refuses it sub mail_message() { open(MAIL |"$sendmail -t ") || die "Can not open the mail programm \n";
7
1741
by: Shelly | last post by:
I submitted this to comp.mail.sendmail, but maybe someone here can help me as well. OK, this has most likely been asked and answered several times, but I am still confused after searching. Here is the background and situation: Background: I know nothing about sendmail. It is being set up on the system by someone else on a Red Hat Linux system. I know Unix, but it has been a while and I am not an expert on that OS.
2
17477
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to the bare minimum: System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("<my mail server IP>", 25); smtp.Send("<one of my email addresses>", "<another of my email addresses>", "Hello", "World");
6
1875
by: Guern1 | last post by:
Help Please I am very new to the Perl game and need some help I have a Perl application which works fine and can output some plain text information that I need to send to selected users via e-mail. The e-mail address are under the $addr and the information that I whish to put in the e-mail message are held in $msg I have installed and have working Sendmail the script that I have come up with so far is
0
2465
by: s2rinivasan | last post by:
I am srinivasan I sent a last message hoe to trouble shoot httpd passwd acces problum. In that I didn't menson that OS=RedHat LINUX EL4-2.6.9-5. This question also in the same version. In sendmail configuraton I did configure very carefully in /sendmail.mc and redirect it to /sendmail.cf by m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf and alternate the current version to /usr/sbin/sendmail.sendmail but when restart the
3
5949
by: zaxxon25 | last post by:
I am having an issue with attaching 2 attachments one xip and other excel file with email and sending using perl sendmail. I tried to look on various forums and everywhere i get advice using MIME :: Lite. Unfortunately i cannot use it . I have tried to write a program on my own to send 2 attachments and sending using perl sendmail but program is not working. It is reading only first file for attachment purposes and ignores second one.I would...
2
5890
mikek12004
by: mikek12004 | last post by:
Before posting here I google it and saw ablut 30 pages for a solution so I pretty much excluded the obvious things. The code is <?php //now to send the mails to seller require("class.phpmailer.php"); $mail = new PHPMailer(); //$mail->IsSMTP(); // telling the class to use SMTP //$mail->Host = "smtp.example.com"; // SMTP server $from = "vasilis@emile.com"; $mail->From = $from;
0
9112
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8971
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8824
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5831
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4571
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2994
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2258
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.