473,594 Members | 2,713 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 3380
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
3029
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
1529
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
2075
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
1739
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
17465
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
1871
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
2464
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
5940
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
5871
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
7946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7876
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8372
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...
0
8234
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
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...
1
2385
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
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
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.