How to mail in command line.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to mail in command line.
# 1  
Old 08-30-2008
Bug How to mail in command line.

Hi
Can any one guide me how to mail in ssh command terminal with help of mutt or sendmail command from a proxy client machine . My proxy server is using squid proxy.
# 2  
Old 09-01-2008
Most flavours of Unix have a mail or mailx command which you can use like this:

Code:
mail -s "a subject" recipient@example.com << HERE
some email body
HERE

# 3  
Old 09-01-2008
If mutt is available, that offers a richer set of options, and the ability to sensibly include attachments to the message, with basically the same syntax.

Sendmail works the same way, too, but you need to put the headers in the message yourself.

Code:
sendmail -oi -t <<HERE
From: user@example.net
To: recipient@example.com
Subject: AYBABTU

All your base are belong to us
HERE

This is a FAQ; if you need more help, please search this site for threads related to your problem.
# 4  
Old 09-01-2008
Quote:
Originally Posted by era
If mutt is available, that offers a richer set of options, and the ability to sensibly include attachments to the message, with basically the same syntax.

Sendmail works the same way, too, but you need to put the headers in the message yourself.

Code:
sendmail -oi -t <<HERE
From: user@example.net
To: recipient@example.com
Subject: AYBABTU

All your base are belong to us
HERE

This is a FAQ; if you need more help, please search this site for threads related to your problem.
you have some ways to send files with mail/mailx
# 5  
Old 09-01-2008
Quote:
Originally Posted by broli
you have some ways to send files with mail/mailx
You can try like:

Code:
mail user@domain.com -c cc_user@domain.dom -s "Subject line" < filename

# 6  
Old 09-01-2008
Quote:
Originally Posted by dennis.jacob
You can try like:

Code:
mail user@domain.com -c cc_user@domain.dom -s "Subject line" < filename

i was talking about

(echo "Body of e mail"; uuencode <list of files> ) | mailx -s "Subject of email" mail@addres
# 7  
Old 09-01-2008
uuencode only accepts one file at a time, so you may need multiple uuencode commands or a for loop. The first optional parameter is the name of the local file, and the second paramater is the name given to the attachment. They are both assumed to be the same if only one parameter is given.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Creating a function that sends a mail using mail command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The function will be called m and it will allow you to send an email to someone using the mail command. The... (1 Reply)
Discussion started by: Drucian
1 Replies

2. Shell Programming and Scripting

Unable to set end of line in mail command

Hi , Am trying to send mail using the mail command, but the mail command is working but its not sending automatically after pressing .(dot) in the command prompt it sends . How to achieve that. Also it showing the below line after pressing the dot . /home/abc1/dead.letter... Saved message in... (5 Replies)
Discussion started by: rogerben
5 Replies

3. UNIX for Dummies Questions & Answers

POP3 Mail Client (Command Line)

Hi list, I need a POP3 mail client which I can use from the command line within a bash shell script to download email to a folder location. Can anyone recommend a good POP3 client which can be used from the command line in bash? Using redhat enterprise linux 5 and 6. thanks, Land (2 Replies)
Discussion started by: landossa
2 Replies

4. Shell Programming and Scripting

Send mail from command line

Hi All; I need to send emails from command line in some of my shell scripts. I tried : mail -s "Subject" member@body.com < testfile where test file contains body of the mail This work on my mac computer at work BUT not on my mac laptop. Does anyone have any ideas why? Thanks Walforum (1 Reply)
Discussion started by: walforum
1 Replies

5. UNIX for Dummies Questions & Answers

[SOLVED] Command line mail taking too long to send; unable to qualify my own domain name

Hello, I'm having a problem with my mail. When I send mail, it takes a long time for the send to complete. In the below, datestamp is just a simple script to put in a no-white-space date/time stamp. $ datestamp ; mail woodnt; datestamp 02-05-10@193844 Subject: test timer Cc: ... (0 Replies)
Discussion started by: Narnie
0 Replies

6. UNIX for Dummies Questions & Answers

Sending a simple mail from command line

Hi, How would one send an email from the command line. Just a simple email. I used mailx -s "test" address@server.domain then hit enter. Nothing happens then, I hit Ctrl + C twice, then I can start a new command again. Any help? Tips? I did read up on this, but the examples is much more... (2 Replies)
Discussion started by: McGuywer
2 Replies

7. Solaris

identify the mail server for mail command

Hi , I am new to unix , i am using the mail and mailx command to send the mail .How come i will know the my mail command using which server as mail box.. Please help me .. Thanks in advance (1 Reply)
Discussion started by: julirani
1 Replies

8. AIX

Command line/Script to send E-mail with HTML body and binary attachment

I apoligize for the cross-post but I'm not getting much in the way of help in the dummies forum: I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements: 1. command line switch to specify file name containing message body in HTML format 2. command... (3 Replies)
Discussion started by: G-Man
3 Replies

9. UNIX for Dummies Questions & Answers

command line send mail

Hi, I am trying to send mail in ubuntu. I have installed postfix. In Redhat I could just type: mail name@domain.com I get the error that the command mail is not found. Does anyone know if there is a different command line to send mail? Can I install the command? Thanks, Eric (1 Reply)
Discussion started by: ejbrever
1 Replies

10. Shell Programming and Scripting

E-Mail from command line for UNIX and Perl??

Hi Is there any way to use UNIX and Perl to automate sending e-mail. I got a dynamic changing file that send out to people in my mailing list and want to experinment to see if Perl and UNIX can send it out for me when the content is change. I found a Perl source code but dont really know how to... (4 Replies)
Discussion started by: jy2728
4 Replies
Login or Register to Ask a Question