Not able to send mail on my company's account but gmail in Linux 6.8


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Not able to send mail on my company's account but gmail in Linux 6.8
# 8  
Old 03-08-2017
Hi,

I was more meaning which server was generating the error telling you the address did not exist ? You would indeed see the error in /var/log/maillog, but that file will contain everything your local MTA (Sendmail, Postfix, etc) wants to log. What's important for debugging SMTP issues firstly is knowing where the problem is.

In any case, I think it's probably safe to assume that the error you're getting means what it says it does - that root@ is not a valid e-mail address. So, returning to my other question. What is the exact command you are using, in full, to send the mail ? If we can see a full and complete excerpt of the code you are using, we can then advise what might be going wrong.

But in general, you are going to want to set the From: address for any mail you ever send to be valid, if the mail is ever going to be leaving the server on which it is created at any rate.

Now, the behaviour of the mail command is highly version and OS-specific, but on my local machine (running Ubuntu 16.04 LTS x86_64) the following syntax works for me to set a valid From: address. Note that I have removed or changed some of the e-mail headers from the output for privacy reasons, so you will see more headers than just these ones (or you should).

Code:
$ mail -s "This is a test" -a "From: example@test.com" unixforum@localhost
Cc:
This is a test.  We should see the From: address is set to a valid SMTP address, and not my local UNIX username.
$ mail
"/var/mail/unixforum": 1 message 1 new
>N   1 example@test.com   Wed Mar  8 07:59  16/820   This is a test
? 1
Return-Path: <example@test.com>
Date: Wed, 8 Mar 2017 07:58:59 GMT
Subject: This is a test
From: example@test.com
To: <unixforum@localhost>
X-Mailer: mail (GNU Mailutils 2.99.99)

This is a test.  We should see the From: address is set to a valid SMTP address, and not my local UNIX username.
? d 1
? q
Held 0 messages in /var/mail/unixforum
$

Normally you'd want a From: header to look more like From: An Example <test@example.com>, but this is just a quick example to demonstrate the principle.

Hope this helps.
# 9  
Old 03-08-2017
I am really glad to see your help.
I am using below command to send the mail from the server where postfix has been installed
echo "hi" | mail -s "test" username@xyz.com
and on the same server , I am getting below erroe from the location
Code:
cat /var/log/maillog

Mar  8 08:07:33 ab-boot-ora postfix/pickup[31850]: 5BD2D542B34: uid=0 from=<root>
Mar  8 08:07:33 ab-boot-ora postfix/cleanup[38600]: 5BD2D542B34: message-id=<20170308080733.5BD2D542B34@localhost>
Mar  8 08:07:33 ab-boot-ora postfix/qmgr[20449]: 5BD2D542B34: from=<root@localhost.localdomain>, size=424, nrcpt=1 (queue active)
Mar  8 08:07:34 ab-boot-ora postfix/smtp[38602]: 5BD2D542B34: to=<username@abc.com>, relay=mx2.abc.com[]:25, delay=1.4, delays=0.03/0.01/1.2/0.11, dsn=5.0.0, status=bounced (host mx2.abc.com[69.150.27.74] said: 553 #5.1.8 Domain of sender address <root@localhost.localdomain> does not exist (in reply to MAIL FROM command))
Mar  8 08:07:34 ab-boot-ora postfix/cleanup[38600]: CA9A7542B3A: message-id=<20170308080734.CA9A7542B3A@localhost>
Mar  8 08:07:34 ab-boot-ora postfix/bounce[38604]: 5BD2D542B34: sender non-delivery notification: CA9A7542B3A
Mar  8 08:07:34 ab-boot-ora postfix/qmgr[20449]: CA9A7542B3A: from=<>, size=2356, nrcpt=1 (queue active)
Mar  8 08:07:34 ab-boot-ora postfix/qmgr[20449]: 5BD2D542B34: removed
Mar  8 08:07:34 ab-boot-ora postfix/local[38605]: CA9A7542B3A: to=<root@localhost.localdomain>, relay=local, delay=0.01, delays=0/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Mar  8 08:07:34 ab-boot-ora postfix/qmgr[20449]: CA9A7542B3A: removed


Last edited by rbatte1; 03-08-2017 at 11:24 AM.. Reason: Added CODE tags
# 10  
Old 03-08-2017
Hi,

OK, thanks. The problem does indeed appear to be that you are sending mail as root@localhost.localdomain, which external mail servers will indeed rightly reject as being invalid (because it is).

Try setting the From: header to something valid using the same technique as in my previous example, and see how you get on.
# 11  
Old 03-08-2017
Thanks, I used below cli
/usr/sbin/sendmail -f username@domain.com username@domain.com

now logs has chnaged got status sent but didnt received mail.

Code:
Mar  8 12:21:17 Ak-Soot-ora postfix/pickup[58644]: 328EC542B3A: uid=0 from=<username@domain.com>
Mar  8 12:21:17 Ak-Soot-ora postfix/cleanup[59848]: 328EC542B3A: message-id=<20170308122117.328EC542B3A@Ak-Soot-ora.domain.com>
Mar  8 12:21:17 Ak-Soot-ora postfix/qmgr[41697]: 328EC542B3A: from=<username@domain.com>, size=302, nrcpt=1 (queue active)
Mar  8 12:21:25 Ak-Soot-ora postfix/smtp[59850]: 328EC542B3A: to=<username@domain.com>, relay=mx4.domain.com[]:25, delay=12, delays=3.9/0/6.8/1.7, dsn=2.0.0, status=sent (250 ok:  Message 22911887 accepted)
Mar  8 12:21:25 Ak-Soot-ora postfix/qmgr[41697]: 328EC542B3A: removed


Last edited by rbatte1; 03-08-2017 at 11:23 AM.. Reason: Added CODE tags
# 12  
Old 03-08-2017
Hi,

Well, that indicates your mail was successfully delivered to the mail server which was the next hop in the chain. You'd have to check the mail logs on that server (or ask whoever manages that server to check them, if it isn't you) to see what became of your e-mail after that server took delivery of it.

Last edited by drysdalk; 03-08-2017 at 09:57 AM..
# 13  
Old 03-08-2017
Above logs i captured from /var/log/maillog..so mail logs is something different ?

---------- Post updated at 08:48 AM ---------- Previous update was at 08:42 AM ----------

could you please remove ip address from the above reply ..Thanks
# 14  
Old 03-08-2017
Hi,

The excerpt of /var/log/maillog which you posted showed the message being passed from your own system, to another system. You now need to log on to that other system (the one whose IP I've now removed from the previous post, as per your request), and see what it then did with the mail. If it's a UNIX-style system then it will most likely have a /var/log/maillog of its own. If it's something else (Microsoft Exchange, say) then it will have another mechanism for checking what happened to the mail.

E-mail delivery is a chain of events leading from the sending server all the way through to the server that finally knows what to actually do with the mail in question, often with other intermediary servers in between. You have to trace what happened to the mail at each step along its journey to its final destination to figure out why it's not been delivered. The logs on your own workstation won't be enough, since all they show is that your local MTA did its job, and passed the mail on to the server that it believed would know what to do with it next.
This User Gave Thanks to drysdalk For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Programming

How to send a file in e-mail from on Linux C++?

Hi ! I-m copile from source a C++ program from tutorials from internet. I don't understendig any programing languages.. but compiled aplication running ok. I-ts possible to add in my used program, lines to send one file from config directory in e-mail, to my e-mail adress ? I want to run... (2 Replies)
Discussion started by: kraftwerk
2 Replies

2. Red Hat

unable to send mail from redhat linux server

While sending mail from linux server we observed below logs, stat=Deferred: Name server: xxxxxxxxxx.: host name lookup failure Kindly suggest what we need to change? Thanks in Advance (2 Replies)
Discussion started by: hydoss1
2 Replies

3. Red Hat

mail not working with company id

Hi, I have a fresh new installation of red hat linux. I am trying to send an email from the "mail" utility from inside my Linux box to my company id "xxx@company.com". We are using microsoft exchange server online version to host our company's email. I am able to send emails to gmail and... (2 Replies)
Discussion started by: priya33184
2 Replies

4. Shell Programming and Scripting

Send mail from linux

Hi, Could any one get me suggested how to send a mail from a linux server to any external user? I tried the following : $ mail abc@xyz.com Subject: test Hi, This is a test mail. . Cc: def@xyz.com But I haven't recived any mail at abc@xyz.com and def@xyz.com Kindly help on... (2 Replies)
Discussion started by: yogi_4984
2 Replies

5. UNIX for Dummies Questions & Answers

using mailx to send a log file to my outlook e-mail account

I like to use mailx -s to send an entire xxxxx.log to my outlook e-mail account. Any help will be appreciated. Thanks. (6 Replies)
Discussion started by: simt
6 Replies

6. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies
Login or Register to Ask a Question