Sending email from a script & specifying the "from" address


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending email from a script & specifying the "from" address
# 1  
Old 11-21-2012
Sending email from a script & specifying the "from" address

Hello all, I have a requirement to send an email from a shell script. Simple enough. A google search gives thousands of examples. But here's the catch. I need to be able to specify the "from" address, and none of the examples I've found allow for that.

When I used the mail or mailx commands, the email goes out just fine, but it comes from oracle@hostname.domain.com

I need the "from" address to be webmaster@domain.com

I could write an Expect script that telnets to the SMTP server on port 25 and issues the relevant commands, but I feel like there must be a simpler solution.

The goal is that so when people reply to this automated message, it goes to a valid deliverable email address. oracle@hostname.domain.com is not a valid email address, since no SMTP server is running on hostname.domain.com

Thank you

Last edited by lupin..the..3rd; 11-21-2012 at 05:35 PM..
# 2  
Old 11-21-2012
Use -r option with mailx:-
Code:
echo "Testing From" | mailx -r "webmaster@domain.com" -s "Subject" user@domain.com

This User Gave Thanks to Yoda For This Post:
# 3  
Old 11-23-2012
Ive been using a binary called "sendEmail" for years. It works great and gives you lots of flexibility for sending mail from scripts -from address, smtp server, username, pass, etc. all the options you'd need. Not sure your platform, but almost all are supported.

Software :: SendEmail - Send email with this free command line email client
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find files in sub dir with tag & add "." at the beginning [tag -f "Note" . | xargs -0 {} mv {} .{}]

I am trying find files in sub dir with certain tags using tag command, and add the period to the beginning. I can't use chflags hidden {} cause it doesn't add period to the beginning of the string for web purpose. So far with my knowledge, I only know mdfind or tag can be used to search files with... (6 Replies)
Discussion started by: Nexeu
6 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Web Development

How would I mod_rewrite "/~a1Pha" and "/=a1Pha" to "/paste/a1Pha.htm"? (internally & externally)

Basically I want to shorten URLs on my html pasting site (pasteht.ml), by using "/~a1Pha" instead of "/paste/a1Pha". The ID is 5 numbers and letters, both cases. For example: /~idnum serves /paste/idnum.htm /=idnum serves /paste/idnum.htm /paste/idnum redirects to /~idnum (to update any old... (0 Replies)
Discussion started by: phillips1012
0 Replies

5. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

6. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

7. UNIX for Dummies Questions & Answers

Printing & sending "user ID"

We print from ERP (on AIX 5.3.0.0) to HP (and Sharp) network printers; we use the QPRT command (for example): qprt -Pfin8 -Z! -c -d p -N%d %s For that we use 'hp_lj4' driver (old but useful) where the following initpr (PCL commands) is (for example):... (0 Replies)
Discussion started by: frajer
0 Replies

8. Shell Programming and Scripting

Grep & EMail "HOW to quit ??? "

Hello All, I am using the below code to grep particular word from file and then emailing it through mail command. the problem is this that when i run the script so it stops and ask me for the mail body then it asks for cc: and then runs. I dont want to give body and cc: address, i just want... (1 Reply)
Discussion started by: wakhan
1 Replies

9. UNIX for Dummies Questions & Answers

Run away "bootpgw" & "inetd"

Hello All. I'm get the following messages posted to the /var/adm/syslog file ever second and not sure on how to stop the process. May 14 15:50:52 a3360 bootpgw: version 2.3.5 May 14 15:50:52 a3360 inetd: /etc/bootpgw exit 0x1 As said about this gets logged every second only thing that... (4 Replies)
Discussion started by: cfaiman
4 Replies
Login or Register to Ask a Question