Mailx Email Issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mailx Email Issue
# 1  
Old 11-27-2018
Mailx Email Issue

Hello,


I am facing an issue with email in Linux. I am using mailx command to send email.
When I give invalid domain address then it is taking both sender and recipient as sender email and trying to send email.
Below is my command


Code:
echo -e "${EMAIL_TEXT}" | mailx -v -s "${SUBJECT}" -r "${FROM}"  "${TO}" >$EMAIL_RESP

here FROM=testuser@gmail.com
TO=123415@atxtxde.cosdlfmsdogfsdkfc..ocmd

Below is the response


Code:
123415@atxtxde.cosdlfmsdogfsdkfc..ocmd... Invalid host name

220 xxxx ESMTP AT&T sendmail 8.14.5/8.14.5; Tue, 27 Nov 2018 09:25:55 -0800
>>> EHLO xxxxx
250- xxxx localhost.localdomain xxxx, pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 16000000
250-DSN
250-DELIVERBY
250 HELP
>>> MAIL From:<> SIZE=1467
250 2.1.0 <>... Sender ok
>>> RCPT To:<testUser@gmail.com>
>>> DATA
250 2.1.5 <testuser@gmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 wARHPtoW011748 Message accepted for delivery
testuser@gmail.com... Sent (wARHPtoW011748 Message accepted for delivery)
Closing connection to ..
>>> QUIT

Can anyone please help?

Last edited by Scott; 11-27-2018 at 02:46 PM.. Reason: Please use CODE tags
# 2  
Old 11-27-2018
sendmail/mailx/etc differ wildly from implementation to implementation. Mine doesn't take -r at all. Which you have depends on what your local system's MTA, i.e. mail server, is. What is it?
# 3  
Old 11-27-2018
Thanks for the response. Can you please suggest how should I check for running mail server? I tried this netstat -ltnp |grep :25 but it shows tcp with some ip's.
# 4  
Old 11-27-2018
ps aux and see what processes are running perhaps. If you're the administrator, you can just check what programs you installed.
# 5  
Old 11-27-2018
I see something as below related to mail. Does this information enough?


smmsp 5448 0.0 0.0 23528 672 ? Ss Nov25 0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
# 6  
Old 11-27-2018
That might be sendmail, maybe... which doesn't provide mailx. So I'm not sure which third-party mailx you have.

The sendmail utility should work also:

Code:
sendmail "${TO}" <<EOF
To:  ${TO}
From:  ${FROM}
Subject:  ${SUBJECT}

${EMAIL_TEXT}
.
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx issue; email address starting with #

Hello All, I have a requirement to generate report and send them to a distribution list. The problem I am facing is when sending out the email using mailx. The email address (DL) we have is starting with # and because of this it's not recognising the email and throwing the below error. ... (2 Replies)
Discussion started by: Pradeep_Raj
2 Replies

2. Shell Programming and Scripting

MAILX too much time to send email

Hello, I am using heirloom-mailx on UBUNTU 11.04 to create a bash script that sends an e-mail with an attachment. The command invoked is : echo $BODY | mailx -v \ -S smtp=smtps://$smtpmailserver:465 \ -S from=$MITTENTE \ -S ssl-verify=ignore \ -S smtp-auth=login \ -S smtp-auth-user=$USER \... (8 Replies)
Discussion started by: occhiverdi1987
8 Replies

3. Shell Programming and Scripting

Sending HTML Email through mailx

Hi, I am trying to send html email using mailx like follow on sh shell (Bourne) on HP-UX: mailx -s "Test HTML output in outlook MIME-Version: 1.0 Content-Type: text/html" receiver@host.com < file.txt Content of file.txt are as follows: <html> <h2>An important link to look at!</h2>... (3 Replies)
Discussion started by: manubatham20
3 Replies

4. Shell Programming and Scripting

The body of the Email -- mailx

Hi, I am using mailx command to send an email and i took the body of the email from a file, mailx -r gtt.org -s "Status Report " ss@org.com < $ProcessStatisticsFile but now i want to declare the body of the email in the command itself. I have tried with the following command but... (4 Replies)
Discussion started by: chinnu01
4 Replies

5. Solaris

How can i use Mailx to send email

I would like to use Mailx command, please i hope when you replay give me example. because this is very good think for me. I am New in sun Microsystems Solaris 10, i hope to give me also rules to learn Solaris easily. Thank you Joseph Shafik (8 Replies)
Discussion started by: J.shafik
8 Replies

6. UNIX for Dummies Questions & Answers

retract email in mailx

Does anyone know if it is possible to retract email sent by mailx? Thanks! (2 Replies)
Discussion started by: pinkgladiator
2 Replies

7. UNIX for Dummies Questions & Answers

Not able to send email as CC to a ID using Mailx command in HP UX

Hey Guys, I have been trying to send a email as ccto a email ID .However it seems the -c option is not working in HP UX system. It is shooting an error as "mailx: illegal option -- c" My script isin the below manner: mailx -c EMAIL_IDS_CC# -s 'BDC reminder' -r sender@email.com... (1 Reply)
Discussion started by: rohit.shetty84
1 Replies

8. Shell Programming and Scripting

Mailx Return Email Command

Hi, I'm trying to use the Mailx Return Email Command with a file attachment. If I use the file attachment by itself, it works ok. But If I add the return email command, it won't attach the file to email. Subject, return_email_address Send_email_address, Body, attachment,... (1 Reply)
Discussion started by: lisa0703
1 Replies

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

10. UNIX for Dummies Questions & Answers

sending email from mailx

hi can i know how to use mailx to send email to my lotus email account? i wan to send a file in a directory as an attachment and then email to lotus. can show me the command line to do it? thanks a lot (1 Reply)
Discussion started by: legato
1 Replies
Login or Register to Ask a Question