Sending email from UNIX server


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Sending email from UNIX server
# 1  
Old 04-29-2013
Sending email from UNIX server

Hi,

I am trying to send an output of a script in an email.
I want to know if there is a way to modify the senders email not as my username on the host server but as one of the sender preset on outlook.

I was using
Code:
cat email.log | /bin/mailx -c cclist -r myemailid -s "subject" tolistids

I want to change that myemailid to a name present in outlook.
# 2  
Old 04-29-2013
Use code tags for code, please.

What do you have for your From header in the text file?
# 3  
Old 04-29-2013
Also can you tell us what OS you are using:
Code:
uname

Also the mailx version that you are using:
Code:
$ mailx
Mail version 8.1 6/6/93

# 4  
Old 04-29-2013
here is the code i was trying

Code:
export ORACLE_HOME=/usr/local/opt/oracle/product/10.2.0
export PATH=${PATH}:${ORACLE_HOME}/bin

cat /dev/null > dsltn_sustaining
cat /dev/null > dsltn_sustaining_email.log

#some script contaning sql query
.getTNsql > dsltn_sustaining

echo "Fixing TNs in sustaining profile(s)" | tee -a dsltn_sustaining_email.log

cat dsltn_sustaining | while read dsltn
do
        echo "TN ${dsltn}" | tee -a dsltn_sustaining_email.log
        script1.ksh ${dsltn} >> dsltn_sustaining.log
done

tn_count=`cat dsltn_sustaining | wc -l`
echo "The number of TN's for which the sustaining profile fix was run is ${tn_count}" | tee -a dsltn_sustaining_email.log
cat dsltn_sustaining_email.log | /bin/mailx -c ggg@email.com -r ggg@email.com -s "List of TNs in sustaining profile" ggg@email.com>
 /dev/null 2>&1

Code:
$ uname
SunOS
$ mailx
mailx version 5.0


Last edited by gopajitmalakar; 04-29-2013 at 02:13 PM..
# 5  
Old 04-29-2013
-r option is used to specify return/from address.

Just change it to whatever address you want:
Code:
/bin/mailx -c ggg@email.com -r ggg@email.com -s "List of TNs in sustaining profile" ggg@email.com

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending email in UNIX

can you tell me what is the syntax if I need to keep someone in cc with the below email. mailx -s "shell script completed successfully" arun@gmail.com < /dev/null (4 Replies)
Discussion started by: ramkumar15
4 Replies

2. UNIX for Dummies Questions & Answers

Sending formatted email from unix.

Hi All, I need to send email from unix in the below format. But the email body is coming all in one single line. How do i format the below text, so that the body of email is properly formatted. Please help. TO: <email id> CC: <none> BCC: <none> Subject: Support: file GENERATION is... (3 Replies)
Discussion started by: abhi_123
3 Replies

3. Shell Programming and Scripting

Sending email from a unix program

Hi, I have create a unix prog file to validate data and send out an email. Below is the command used to send out email in the program. But it is not triggering the email. Please advice on this. (echo ${MESSAGE};uuencode "$FCP_OUT" "ERROR_REPORT.csv"; uuencode "$VALIDATION_RPT"... (1 Reply)
Discussion started by: contactsmrajesh
1 Replies

4. Shell Programming and Scripting

Font change in unix while sending email

Hi, I know that we would be require HTML to change the font and color of the text of the output, if we wnt to send that through the email. But I have managed to get below code, can someone look into it and let me know if i can acheive my requirement through this kind of code: Following can... (9 Replies)
Discussion started by: amit.mathur08
9 Replies

5. Shell Programming and Scripting

Sending email from Unix

I am using the following syntax to send an e-mail from Unix (Sun OS). mail -s "hello" abc@yahoo.com But, when I click enter after typing this command, its not exiting and after a while when I give ctrl+c it creates a dead.letter file in my $HOME dir. Can anyone please tell me, if I have to... (7 Replies)
Discussion started by: rajesh8s
7 Replies

6. HP-UX

Sending Unix files as attachments in an email

Hi, I am executing the following command in order to send a file as an attachment: mailx -s "Subject" emailID@xyz.com < Testfile.txt Instead of attaching the file Testfile.txt, it is writing the contents of the file in the email message body. Please advise on how I can send the file as an... (7 Replies)
Discussion started by: sangharsh
7 Replies

7. UNIX for Advanced & Expert Users

sending email via mail server

hi everyone i am facing one problem. there is one unix server in our organisation which stores daily routine backup, and one mail server which is on windows 2k3, they are on one intranet. now i want that a mail should be generated and sent to the e-mail id of employees like nitin@hotmail.com... (1 Reply)
Discussion started by: parmeet
1 Replies

8. BSD

help request for sending email from unix to internet

I have a requirement to send email to a group once I have done some tests. I tried the following from command line:- mailx -s "Test REsults for today " myname@companyname.com <testresultfile.txt but the email was not received by anyone basically I followed the format: mailx -s... (1 Reply)
Discussion started by: sbabuts
1 Replies

9. Shell Programming and Scripting

sending email in unix. need help!

how can I send an email in UNIX, attach a file and cc a receipient? i use the command below to attach a file (this works): uuencode path/filename filename | mailx -s "subject" addr@host.com here is how i cc a receipient (this also works): i have a file named cc.lis and contains: Hello... (2 Replies)
Discussion started by: tads98
2 Replies

10. Shell Programming and Scripting

unix - c program sending error from DB to email

hi, i have a database table that automatically logs the errors in the database every 5 mins. what i want to happen is to come up with a program using unix-c that gets all the information from the log table, i have a flag initially set to zero which means that the error is not yet sent, the... (2 Replies)
Discussion started by: chino_52284
2 Replies
Login or Register to Ask a Question