send mail from unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting send mail from unix
# 1  
Old 05-05-2010
send mail from unix

Hi all,
I'm trying to send a mail from Unix to my company domain. It
doesn't show me any error but i dnt even receive mail in my inbox.
I'm using

Code:
mailx -s "sub" name@company_domain.com <file.txt

I have few contents in the file which should be sent as message body of the
mail NOT AS ATTACHMENT.

I have gone thru a lot of the threads & still wasn't able to understand. M
a newbie to unix. Any help be appreciated.
# 2  
Old 05-05-2010
Check the mail box ( in unix ) using the mail command to see , if mail sending failed due to any reason.
# 3  
Old 05-05-2010
Teminate input

man mailx says
Code:
Sending mail
       To send a message to one or more people, mailx can be invoked  with  argu-
       ments  which  are  the names of people to whom the mail will be sent.  The
       user is then expected to type in his message, followed by  an  ‘control-D'
       at  the beginning of a line.  The section below Replying to or originating
       mail, describes some features of mailx available to  help  when  composing
       letters.

To put a <control-d> into a file you can use an echo command, in VI do Insert and the type <control-v><control-d><esc>, in Emacs <control-q><control-d>. Oh, on the command line it is <control-v><control-d> for Bash under Gnome.

As an experiment try...
Code:
echo "" >> email.txt
echo "^D" >> email.txt

Then do the mailx command. Still getting the email as an attachment? Try the above and then a pipe.

Code:
# Above code
cat email.txt | mailx --OPTIONS

--- Added 20100505 21:28

Hey, I just tried your mailx command and it worked fine so you do not need a <control-d> in the file. I bet your email is not getting out as panyam suggested. You can examine /var/log/maillog for failures also. I can send mail to myself on my machine but trying to leave my network I get an error about unauthorized relay, which I would expect. In order to get off your machine you need to configure your Mail Transfer Agent (MTA).

Here is a discussion of changing 'sendmail' to use a SMTP server that you are allowed to access.

Last edited by m1xram; 05-06-2010 at 12:46 AM.. Reason: further testing
# 4  
Old 05-05-2010
Hi
You can check here for mailing in HP or Sun with body : Mailing from command line in UNIX
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Send mail from UNIX

Hi, I am executing the below commands, i didnt get any error and send mail not recevied by respective user. Please help cat a.txt | mailx -s "config" xxx@abc.com (4 Replies)
Discussion started by: sugumar
4 Replies

2. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies

3. Shell Programming and Scripting

send mail through unix

Hi i am automating my task and i got an issue. what i want to do is when certain condition is met the email should be sent to the user. and the user should presume that the email has comes from like support@xyz.com The scenario is like send email as different user (4 Replies)
Discussion started by: parthmittal2007
4 Replies

4. Shell Programming and Scripting

send mail through Unix

Hi Can any one please help me how to send mail through unix. (3 Replies)
Discussion started by: parthmittal2007
3 Replies

5. Shell Programming and Scripting

How to send mail in Unix

Hi, I am able to generate the log file from my shell file. How can i send the content of the log file through mail to some one. Raja (6 Replies)
Discussion started by: konankir
6 Replies

6. Solaris

send mail from UNIX

Hi We have configured the mail server in our unix box. Still while trying to send mail it goes to dead letter. We issued the command as mailx -s "Hello" someone@somewhere.com Note: Is that required to reboot the server once the send mail is configured in the server. OS Version :... (5 Replies)
Discussion started by: prashanth_gs
5 Replies

7. UNIX for Dummies Questions & Answers

I am not able to send mail form unix to other mail accounts.

Using Mailx command i.e mailx -s "subject" chinni@hotmail.com < \tmp\chin this command executed sucessfully but not able to receive the mail in chinni@hotmail.com please help. (1 Reply)
Discussion started by: chinnigd
1 Replies

8. Shell Programming and Scripting

how to send mail in unix

Dear friends, I want to send mail automatically like (crontab). I have tried with mail command but it it not working. mail -s "hello" xyz@yahoo.com. please help. (12 Replies)
Discussion started by: rajan_ka1
12 Replies

9. Programming

? i want to send a mail with a C code under Unix ?

Hi all ! I want to know if i can send an email with a C code... the thing i wanna do is when my code is finished it creates a log file with all the information of the process in it...i want to know if its possible at the and of my code in C, under Unix_Solaris, to send that log file to a... (4 Replies)
Discussion started by: UnknownCoder
4 Replies

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