Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Not able to send mail on my company's account but gmail in Linux 6.8 Post 302993250 by drysdalk on Wednesday 8th of March 2017 03:03:02 AM
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.
 

6 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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
MU-CFIND(1)                                                   General Commands Manual                                                  MU-CFIND(1)

NAME
mu_cfind - find contacts in the mu database and export them for use in other programs. SYNOPSIS
mu cfind [options] [<pattern>] DESCRIPTION
mu cfind is the mu command for finding contacts (name and e-mail address of people who were either sender or receiver of mail). There are different output formats available, for importing the contacts into other programs. SEARCHING CONTACTS
When you index your messages (see mu index), mu creates a list of unique e-mail addresses found and the accompanying name. In case the same e-mail address is used with different names, the most recent non-empty name is used. mu cfind starts a search for contacts that match a regular expression. For example: $ mu cfind '@gmail.com' would find all contacts with a gmail-address, while $ mu cfind Mary would find all contact with Mary in either name or e-mail address. If you do not specify any search expression, mu cfind will return the full list of contacts. The regular expressions are Perl-compatible (as per the PCRE-library). OPTIONS
--format=plain|mutt-alias|mutt-ab|wl|org-contact|bbdb|csv sets the output format to the given value. The following are available: | --format= | description | |-------------+-----------------------------------| | plain | default, simple list | | mutt-alias | mutt alias-format | | mutt-ab | mutt external address book format | | wl | wanderlust addressbook format | | org-contact | org-mode org-contact format | | bbdb | BBDB format | | csv | comma-separated values | RETURN VALUE
mu cfind returns 0 upon successful completion -- that is, at least one contact was found. Anything else leads to a non-zero return value, for example: | code | meaning | |------+--------------------------------| | 0 | ok | | 1 | general error | | 2 | no matches (for 'mu cfind') | INTEGRATION WITH MUTT
You can use mu cfind as an external address book server for mutt. For this to work, add the following to your muttrc: set query_command = "mu cfind --format=mutt-ab '%s'" Now, in mutt, you can easily search for e-mail address using the query-command, which is (by default) accessible by pressing Q. ENCODING
mu cfind output is encoded according to the current locale except for --format=bbdb. This is hard-coded to UTF-8, and as such specified in the output-file, so emacs/bbdb can handle it correctly without guessing. BUGS
Please report bugs if you find them at http://code.google.com/p/mu0/issues/list. AUTHOR
Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> SEE ALSO
mu(1) mu-index(1) mu-find(1) pcrepattern(3) User Manuals May 2011 MU-CFIND(1)
All times are GMT -4. The time now is 10:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy