simple sendmail problem

simple sendmail problem

am 20.01.2008 16:31:47 von deepak

Hi all,
Please help me with this program. i'm not able to send mail to the
sample id 'deepak.battu@yahoo.co.in'.
============================================================ =====
#!/usr/bin/perl
sub sendEmail
{
my ($to, $from, $subject, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
close(MAIL);
}
sendEmail("deepak.battu\@yahoo.co.in", "ramakrishnadeepak\@gmail.com",
"Simple email.", "This is a test of the email function.");
============================================================ =======


The log file shows me like this:

Jan 20 20:44:33 localhost sendmail[10854]: m0KFEJdM010854:
to=deepak.battu@yahoo.co.in, ctladdr=root (0/0), delay=00:00:14,
xdelay=00:00:14, mailer=relay, pri=30125, relay=[127.0.0.1]
[127.0.0.1], dsn=5.6.0, stat=Data format error


Is that, we cant transfer a mail from localhost domain?

Re: simple sendmail problem

am 20.01.2008 16:44:27 von Andrzej Filip

deepak writes:

> Hi all,
> Please help me with this program. i'm not able to send mail to the
> sample id 'deepak.battu@yahoo.co.in'.
> ============================================================ =====
> #!/usr/bin/perl
> sub sendEmail
> {
> my ($to, $from, $subject, $message) = @_;
> my $sendmail = '/usr/lib/sendmail';
> open(MAIL, "|$sendmail -oi -t");
> print MAIL "From: $from\n";
> print MAIL "To: $to\n";
> print MAIL "Subject: $subject\n\n";
> print MAIL "$message\n";
> close(MAIL);
> }
> sendEmail("deepak.battu\@yahoo.co.in", "ramakrishnadeepak\@gmail.com",
> "Simple email.", "This is a test of the email function.");
> ============================================================ =======
>
>
> The log file shows me like this:
>
> Jan 20 20:44:33 localhost sendmail[10854]: m0KFEJdM010854:
> to=deepak.battu@yahoo.co.in, ctladdr=root (0/0), delay=00:00:14,
> xdelay=00:00:14, mailer=relay, pri=30125, relay=[127.0.0.1]
> [127.0.0.1], dsn=5.6.0, stat=Data format error
>
>
> Is that, we cant transfer a mail from localhost domain?

Try the shell script below to find out if its your perl script fault or
consequences of you local sendmail configuration (e.g. antispam add-ons).
The script invokes sendmail in verbose mode.

#!/bin/sh
TO='deepak.battu@example.com'
FROM='ramakrishnadeepak@example.net'

/usr/lib/sendmail -v -oi -- $TO < From: $from
To: $to
Subject: test message

Email test
END

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
I am not a member of any organized party — I am a Democrat.
-- Will Rogers (1879-1935)
----
http://groups.google.com/groups?selm=87hch8fqn8@robert.fsf.h obby-site.com

Re: simple sendmail problem

am 20.01.2008 17:00:12 von Mark Hansen

On 01/20/08 07:44, Andrzej Adam Filip wrote:
> deepak writes:
>
>> Hi all,
>> Please help me with this program. i'm not able to send mail to the
>> sample id 'deepak.battu@yahoo.co.in'.
>> ============================================================ =====
>> #!/usr/bin/perl
>> sub sendEmail
>> {
>> my ($to, $from, $subject, $message) = @_;
>> my $sendmail = '/usr/lib/sendmail';
>> open(MAIL, "|$sendmail -oi -t");
>> print MAIL "From: $from\n";
>> print MAIL "To: $to\n";
>> print MAIL "Subject: $subject\n\n";
>> print MAIL "$message\n";
>> close(MAIL);
>> }
>> sendEmail("deepak.battu\@yahoo.co.in", "ramakrishnadeepak\@gmail.com",
>> "Simple email.", "This is a test of the email function.");
>> ============================================================ =======
>>
>>
>> The log file shows me like this:
>>
>> Jan 20 20:44:33 localhost sendmail[10854]: m0KFEJdM010854:
>> to=deepak.battu@yahoo.co.in, ctladdr=root (0/0), delay=00:00:14,
>> xdelay=00:00:14, mailer=relay, pri=30125, relay=[127.0.0.1]
>> [127.0.0.1], dsn=5.6.0, stat=Data format error
>>
>>
>> Is that, we cant transfer a mail from localhost domain?
>
> Try the shell script below to find out if its your perl script fault or
> consequences of you local sendmail configuration (e.g. antispam add-ons).
> The script invokes sendmail in verbose mode.
>
> #!/bin/sh
> TO='deepak.battu@example.com'
> FROM='ramakrishnadeepak@example.net'
>
> /usr/lib/sendmail -v -oi -- $TO < > From: $from
> To: $to

Oops: $FROM and $from are not the same variable. The above should be:

From: $FROM
To: $TO

> Subject: test message
>
> Email test
> END
>

Re: simple sendmail problem

am 20.01.2008 17:12:42 von deepak

hi ,

I executed the program it shows like this:
=====================================
deepak.battu@yahoo.co.in... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Sun, 20 Jan
2008 21:28:27 +0530
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost [127.0.0.1] (may be forged),
pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From: SIZE=102
553 5.5.4 ... Real domain name required
for sender address
root... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> RSET
250 2.0.0 Reset state
>>> MAIL From:<> SIZE=1126
250 2.1.0 <>... Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 ... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 m0KFwRrW010983 Message accepted for delivery
root... Sent (m0KFwRrW010983 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
===========================================

No mail is seen in the inbox(deepak.@yahoo.co.in..) . and i see a mail
in the root@localhost.localdomain as follows:
===========================================
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Arrival-Date: Sun, 20 Jan 2008 21:32:05 +0530

Final-Recipient: RFC822; deepak.battu@yahoo.co.in
Action: failed
Status: 5.5.4
Diagnostic-Code: SMTP; 553 5.5.4 ... Real
domain name required for sender address
Last-Attempt-Date: Sun, 20 Jan 2008 21:32:20 +0530

--m0KG255l010997.1200844940/localhost.localdomain
Content-Type: message/rfc822

Return-Path:
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id
m0KG255k010997
for deepak.battu@yahoo.co.in; Sun, 20 Jan 2008 21:32:05 +0530
Date: Sun, 20 Jan 2008 21:32:05 +0530
Message-Id: <200801201602.m0KG255k010997@localhost.localdomain>
From: ramakrishnadeepak@gmail.com
To: deepak.battu@yahoo.co.in
Subject: test message

Email test
END
===========================================

Re: simple sendmail problem

am 20.01.2008 17:25:34 von Andrzej Filip

deepak writes:
> I executed the program it shows like this:
> =====================================
> deepak.battu@yahoo.co.in... Connecting to [127.0.0.1] via relay...
> 220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Sun, 20 Jan
> 2008 21:28:27 +0530
>>>> EHLO localhost.localdomain
> 250-localhost.localdomain Hello localhost [127.0.0.1] (may be forged),
> pleased to meet you
> 250-ENHANCEDSTATUSCODES
> 250-PIPELINING
> 250-8BITMIME
> 250-SIZE
> 250-DSN
> 250-ETRN
> 250-DELIVERBY
> 250 HELP
>>>> MAIL From: SIZE=102
> 553 5.5.4 ... Real domain name required
> for sender address

Your local sendmail daemon does not like localhost.localdomain as
envelope sender name (the domain has been added "automagically" by
sending sendmail)

Fixes:
* system wide
a) make "hostname --fqdn" report something different
[OS/vendor specific in "can survive reboot" version]
b) http://www.sendmail.org/m4/whoami.html
[do not forget that sendmail-8.12+ uses sendmail.cf and submit.cf ]
* for one user
specify envelope sender address via -f switch

../sendmail -oi -f$FROM -- $TO <
> [...]

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
"I gained nothing at all from Supreme Enlightenment,
and for that very reason it is called Supreme Enlightenment."
-- Gotama Buddha
----
http://groups.google.com/groups?selm=873assfoqp@john.fsf.hob by-site.com

Re: simple sendmail problem

am 20.01.2008 17:27:23 von Andrzej Filip

Mark Hansen writes:

> On 01/20/08 07:44, Andrzej Adam Filip wrote:
>> deepak writes:
> [...]
>
> Oops: $FROM and $from are not the same variable. The above should be:
>
> From: $FROM
> To: $TO

You are right. Are you surprised? :-)

> [...]

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
The Crown is full of it!
-- Nate Harris, 1775
----
http://groups.google.com/groups?selm=87ve5oea38@gerald.fsf.h obby-site.com

Re: simple sendmail problem

am 20.01.2008 21:30:48 von Mark Hansen

On 01/20/08 08:27, Andrzej Adam Filip wrote:
> Mark Hansen writes:
>
>> On 01/20/08 07:44, Andrzej Adam Filip wrote:
>>> deepak writes:
>> [...]
>>
>> Oops: $FROM and $from are not the same variable. The above should be:
>>
>> From: $FROM
>> To: $TO
>
> You are right. Are you surprised? :-)

Was I surprised that $FROM and $from are not equivalent? - No.

I was just trying to be polite. Did it work?

:-)

Re: simple sendmail problem [OT]

am 20.01.2008 21:48:05 von Andrzej Filip

Mark Hansen writes:

> On 01/20/08 08:27, Andrzej Adam Filip wrote:
>> Mark Hansen writes:
>>
>>> On 01/20/08 07:44, Andrzej Adam Filip wrote:
>>>> deepak writes:
>>> [...]
>>>
>>> Oops: $FROM and $from are not the same variable. The above should be:
>>>
>>> From: $FROM
>>> To: $TO
>>
>> You are right. Are you surprised? :-)
>
> Was I surprised that $FROM and $from are not equivalent? - No.
>
> I was just trying to be polite. Did it work?
>
> :-)

Do not ask *me* [if your politeness worked] :-)

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Open-Sendmail: http://open-sendmail.sourceforge.net/
$you = new YOU;
honk() if $you->love(perl)
-- Seen on Slashdot
----
http://groups.google.com/groups?selm=87ve5ocjga@donald.fsf.h obby-site.com