Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Chomp not working properly with Sendmail

Thread Tools

Chomp not working properly with Sendmail

Aaron Powell
Posts: n/a
I am writing a program for a study I am doing where I must contact several
different organisations stored in a database I compiled, but I need to send
each email one at a time so they don't know who else I sent to.

I tested my sendmail and it works well, but I am having a problem with chomp
in the case I am using it. When getting $email, if I do not say $email\n,
nothing will be displayed to the command prompt. This leads me to believe
that sendmail is also receiving nothing in the To field as its displaying no
recipient has been specified, though it also displays that if you put data
in that it doesn't understand, such as $email with a \n.

Finally, it will always send the last record, the last record in the file
works fine, the rest are the ones that are not understandable.

Any help is appreciated, thank you.

The code is show bellow.


use SendMail;

my $message = "message"

open (FILENO, "emails.txt");
my @file = <FILENO>;
close (FILENO);

foreach $email (@file){

$sm = new SendMail("mailserver");
chomp $email;
print "$email\n";
# Check if the mail sent successfully or not.
if ($sm->sendMail() != 0) {
print $sm->{'error'}."\n";
print "Done\n";
exit 0;

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [sendmail,perl] How to catch a mailer error [perl script as mailer] Andrzej Adam Filip Perl 0 03-31-2008 09:24 PM
chomp - works in irb, not in program Peter Vanderhaden Ruby 8 11-23-2007 06:37 PM
Unable to load tag handler class "com.cj.smtp.Sendmail" for tag "send:Sendmail" sugapablo Java 0 09-21-2007 01:41 PM
"chomp,chop" usage i.e. chop immediately after chomp martin Perl Misc 3 04-15-2006 08:09 PM
Strange issue with `CHOMP' not working... Ignoramus20015 Perl Misc 12 04-12-2006 01:07 AM