LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Not able to send mail. (https://www.linuxquestions.org/questions/linux-newbie-8/not-able-to-send-mail-892871/)

pinga123 07-21-2011 02:29 AM

Not able to send mail.
 
I m not able to configure sntp server at my linux distribution.

Here are the details.
Defined the mail server here.
Code:

/etc/mail/sendmail.mc

dnl define(`SMART_HOST', `XXX.XX.XX.XXX')dnl

ran this command.

Code:

m4 /etc/mail/sendmail.mc /etc/mail/sendmail.cf
restarted the sendmail service.

tried sending mail using .
Code:

mail -v -s "test" username@domain.com < /tmp/abc
but didn't get any mail.

M i missing something?

However i get the mails When i use telnet to send the mail. .

Here is what i m doing.

telnet to the mailserver on port 25 it get connected .

Code:

ehlo domain.com
mail from : username@domain.com
rcpt to : username2@domain.com
data
test


bathory 07-21-2011 04:49 AM

Hi,

You should check the logs in /var/log/maillog to see what happens. Also read the DSN on the returned mail

Regards

pinga123 07-21-2011 06:12 AM

Quote:

Originally Posted by bathory (Post 4421008)
Hi,

You should check the logs in /var/log/maillog to see what happens. Also read the DSN on the returned mail

Regards

dsn is 2.0.0 is this what you is expected.


Code:

Jul 21 16:32:39 HOSTNAME sendmail[16628]: p6LArBmh016628: to=root, ctladdr=root (0/0), delay=00:09:28, xdelay=00:00:00, mailer=relay, pri=30738, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p6LB2dWR017196 Message accepted for delivery)
Jul 21 16:32:39 HOSTNAME sendmail[17197]: p6LB2dWR017196: to=<root@HOSTNAME.domain.com>, ctladdr=<root@HOSTNAME.domain.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31275, dsn=2.0.0, stat=Sent


bathory 07-21-2011 08:19 AM

The chunk of maillog you've posted shows no error, that's why you get a dsn=2.0.0. Besides it's local mail. The smarthost is used when you need to send an email to an external domain.
So, you should send an external email, watch the logs and read the returned mail headers (that is what i meant by DSN), or post 'em here.

Regards

pinga123 07-21-2011 11:48 PM

Quote:

Originally Posted by bathory (Post 4421187)
The chunk of maillog you've posted shows no error, that's why you get a dsn=2.0.0. Besides it's local mail. The smarthost is used when you need to send an email to an external domain.
So, you should send an external email, watch the logs and read the returned mail headers (that is what i meant by DSN), or post 'em here.

Regards

mail eroor
Quote:

Originally Posted by bathory (Post 4421187)
The chunk of maillog you've posted shows no error, that's why you get a dsn=2.0.0. Besides it's local mail. The smarthost is used when you need to send an email to an external domain.
So, you should send an external email, watch the logs and read the returned mail headers (that is what i meant by DSN), or post 'em here.

Regards

Can you please tell me How you differentiate between local mail and external domain?

We have organizational setup and using a single mail server for all machines in the organization.
Does it categorized into local mail(I mean for internal users only) Noob here?

Posting here complete output after i run following command.


Code:

mail -s "test" username@domain.com < /tmp/abc
Code:

Jul 22 09:12:08 HOSTNAME sendmail[10324]: p6M3g7vh010324: from=root, size=47, class=0, nrcpts=1, msgid=<201107220342.p6M3g7vh010324@HOSTNAME.domain.com>, relay=root@localhost
Jul 22 09:12:08 HOSTNAME sendmail[10325]: p6M3g8nH010325: from=<root@HOSTNAME.domain.com>, size=363, class=0, nrcpts=1, msgid=<201107220342.p6M3g7vh010324@hostname.domain.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Jul 22 09:12:08 HOSTNAME sendmail[10324]: p6M3g7vh010324: to=username@domain.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30047, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p6M3g8nH010325 Message accepted for delivery)
Jul 22 09:12:15 HOSTNAME sendmail[10327]: p6M3g8nH010325: to=<username@domain.com>, ctladdr=<root@HOSTNAME.domain.com> (0/0), delay=00:00:07, xdelay=00:00:07, mailer=esmtp, pri=120363, relay=relayserver.domain.com. [xx.xx.xx.xx], dsn=5.6.0, stat=Data format error
Jul 22 09:12:15 HOSTNAME sendmail[10327]: p6M3g8nH010325: p6M3gFnH010327: DSN: Data format error
Jul 22 09:12:15 HOSTNAME sendmail[10327]: p6M3gFnH010327: to=<root@HOSTNAME.domain.com>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31630, dsn=2.0.0, stat=Sent

Jul 22 09:12:38 HOSTNAME sendmail[9815]: p6M3XBIe009815: from=root, size=738, class=0, nrcpts=1, msgid=<201107220333.p6M3XBIe009815@HOSTNAME.domain.com>, relay=root@localhost
Jul 22 09:12:38 HOSTNAME sendmail[10342]: p6M3gcgN010342: from=<root@HOSTNAME.domain.com>, size=1033, class=0, nrcpts=1, msgid=<201107220333.p6M3XBIe009815@hostname.domain.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Jul 22 09:12:38 HOSTNAME sendmail[9815]: p6M3XBIe009815: to=root, ctladdr=root (0/0), delay=00:09:27, xdelay=00:00:00, mailer=relay, pri=30738, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p6M3gcgN010342 Message accepted for delivery)
Jul 22 09:12:38 HOSTNAME sendmail[10343]: p6M3gcgN010342: to=<root@HOSTNAME.domain.com>, ctladdr=<root@HOSTNAME.domain.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31275, dsn=2.0.0, stat=Sent


bathory 07-22-2011 02:36 AM

Hi,

Local mail, is the mail to a local user, i.e. a user that exists on the same host running sendmail. And external is the mail to anyone else.
You can check them by looking at the logs for the "mailer=..."

Now regarding the "Data format error", I guess the smarthost does not like your hostname (localhost.localdomain). Edit /etc/hosts and add your FQDN there

Regards

pinga123 07-22-2011 07:07 AM

Quote:

Originally Posted by bathory (Post 4422060)
Hi,

Local mail, is the mail to a local user, i.e. a user that exists on the same host running sendmail. And external is the mail to anyone else.
You can check them by looking at the logs for the "mailer=..."

Now regarding the "Data format error", I guess the smarthost does not like your hostname (localhost.localdomain). Edit /etc/hosts and add your FQDN there

Regards

I guess even that is not working.

One wild guess .Can switching from sendmail to postfix make it a better choice?

bathory 07-22-2011 07:51 AM

Quote:

Can switching from sendmail to postfix make it a better choice?
If you are not familiar with postfix, it would be difficult too. But, comparing to sendmail it has a more easy to understand configuration.

pinga123 07-24-2011 10:24 PM

Quote:

Originally Posted by bathory (Post 4422251)
If you are not familiar with postfix, it would be difficult too. But, comparing to sendmail it has a more easy to understand configuration.

How would i send mail in case of postfix(After the configuration is done).

In sendmail i used to fire command like.
Code:

mail -s "SUBJECT" username@domain.com < filetobesent.
Do i need to install additional rpm for postfix as in case of sendmail i had to install sendmail-cf-8.13.8-2.el5.

bathory 07-25-2011 01:16 AM

Hi,

You should take a look here

Regards

pinga123 07-25-2011 11:14 PM

I resolve the issue by changing relay server in /etc/mail/sendmail.cf file.
Now i can able to send mail.
But i have to add one extra parameter to attach sender information .
like -- -r sender@domain.com.

Earlier the hostname was used as sender .
Do you guys have any clue over this?
I think there must have been some kind of hardening done on mail server (Wild guess :) )


All times are GMT -5. The time now is 03:38 AM.