473,473 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Chomp not working properly with Sendmail

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.

#!/usr/bin/perl

use SendMail;

my $message = "message"

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

foreach $email (@file){

$sm = new SendMail("mailserver");
$sm->setDebug($sm->ON);
$sm->From("me\@me.com");
$sm->Subject("Header");
chomp $email;
print "$email\n";
$sm->To("$email");
$sm->setMailBody("$message");
#
# Check if the mail sent successfully or not.
#
if ($sm->sendMail() != 0) {
print $sm->{'error'}."\n";
}
print "Done\n";
}
exit 0;
Jul 19 '05 #1
0 2145

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wayno | last post by:
Hoping someone can help me out with this problem. First problem, is I am unable to view my php error log. In my php.ini I have my log in /var/www/logs/php_error_log. However, it has remained empty....
2
by: Babaloo | last post by:
Hello, I am having a problem with PHP 4.2.2 and RH 8. PHP is working fine except email. I have a test script to send mail, I have sendmail_path = '/usr/lib/sendmail -t -i' set in php.ini,...
2
by: STEPHEN GOODE | last post by:
I had a client upgrade his PHP from 4.? to 4.3.9. An important script stopped working. It seems to work fine, but it uses the mail() function and sendmail to send notifications. The email never...
9
by: joealey2003 | last post by:
Hi all... A simple mail example like... <? mail("acco...@yahoo.com","Subject of Message","Message"); ?> does not work to yahoo or spymac.com, but the same works to gmail and other servers.
2
by: Matt Taylor | last post by:
I have this piece of code: $/ = ' '; $test = "abc "; chomp $test; print $test; which prints spaces at the end of the line. Shouldn't chomp strip the spaces off the end of my scalar $test?
6
by: tencip | last post by:
So, we're avoiding using sendmail for obvious security reasons on a highly secured FreeBSD box. However, we need to get mail out of that box to an SMTP relay server. So, we heard about ssmtp,...
4
by: Alexander | last post by:
Hi, for some reason it seems PHP is not properly passing the sender's address to sendmail. It does not matter whether I add "From" as header, "nobody@new" is always taken as originating addres...
35
by: lnatz | last post by:
Hi, Is there an equivalent to the perl command chomp in C? And if there is no exact equivalent command, how would I go about removing the "\n" at the end of a stdin? Thank you, Natalie
2
by: Eric Price | last post by:
Hi; I'm writing a script that includes an email function. So I went to the cookbook and dug up this, and tweaked it just a bit to make it easier to get it to work, but it throws an error: .... ...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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...

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.