mailx

Read lines from File in Bash and parse words into variables for mailx parameters

妖精的绣舞 提交于 2019-12-20 01:35:09
问题 I have a bash script which reads lines from a text file with 4 columns(no headers). The number of lines can be a maximum of 4 lines or less. The words in each line are separated by SPACE character. ab@from.com xyz@to.com;abc@to.com Sub1 MailBody1 xv@from.com abc@to.com;poy@to.com Sub2 MailBody2 mb@from.com gmc@to.com;abc@to.com Sub3 MailBody3 yt@from.com gqw@to.com;xyz@to.com Sub4 MailBody4 Currently, I am parsing the file and after getting each line, I am storing each word in every line into

How can I send an email through the UNIX mailx command?

回眸只為那壹抹淺笑 提交于 2019-12-17 08:04:31
问题 How can I send an email through the UNIX mailx command? 回答1: an example $ echo "something" | mailx -s "subject" recipient@somewhere.com to send attachment $ uuencode file file | mailx -s "subject" recipient@somewhere.com and to send attachment AND write the message body $ (echo "something\n" ; uuencode file file) | mailx -s "subject" recipient@somewhere.com 回答2: Here you are : echo "Body" | mailx -r "FROM_EMAIL" -s "SUBJECT" "To_EMAIL" PS. Body and subject should be kept within double quotes.

Shell script to email results of SQLPlus query using Mailx in AIX

倾然丶 夕夏残阳落幕 提交于 2019-12-12 18:00:52
问题 I have the commands that I need. If I execute these commands at the prompt, everything works as expected. SQLPlus runs the query, exports the result to a file and then Mailx emails that file to me. sqlplus username/pwd@instance SPOOL /home/sadmin/sqlmail/spool.out set linesize 2000 set wrap off @/home/sadmin/sqlmail/query.sql SPOOL OFF exit mail -s "Subject" email@address.com < /home/sadmin/sqlmail/spool.out But, I can not, for the life of me, figure out how to put these in an .sh file so

sending email in linux as subject and attachment

坚强是说给别人听的谎言 提交于 2019-12-11 06:13:20
问题 I have a file that is about 10 columns wide and try to send it as body. mailx fails sending it as body and sends it as a ATT00001.bin file and as an attachment. mail -s "Subject" emailaddress < file.tsv Is there way to solve this. When I try to send it as an attachment, using uuencode echo "body" | uuencode inputattachment.tsv attachment.tsv) | mailx -s "subject" emailaddress I get an email with text that is encoded and looks like this: begin 644 report7.tsv M1&%T92`@("!3=&%T=7,@(#XS,"5V;VP@

Linux configuration — ssmtp: Cannot open smtp.gmail.com:587

别来无恙 提交于 2019-12-09 15:37:42
问题 Hi I have RHEL5 with ssmtp installed on it ssmtp-2.61-22.el5.i386.rpm my /etc/ssmtp/ssmtp.conf updated as below :- AuthUser=mymail@gmail.com AuthPass=mypassword FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES UseTLS=Yes RewriteDomain=gmail.com also revaliases updated as below : root:mymail@gmail.com:smtp.gmail.com:587 i have shutdown sendmail service when i try to send email with ssmtp i get below error [root@ctmtest ssmtp]# echo "test" | ssmtp -vvv mymail@gmail.com [<-] 220

How to send simple text file as attachment using HP-UX shell script?

房东的猫 提交于 2019-12-07 15:00:50
问题 I need to send an email with a text file as attachment using shell script in HP-UX; I don't have mutt installed. I am using following command but it sends the file content in body of email, I want it as an attachment. mailx -s "Report" name@example.com < file.txt 回答1: I wrote this ksh function a few years ago # usage: email_attachment to cc subject body attachment_filename email_attachment() { to="$1" cc="$2" subject="$3" body="$4" filename="${5:-''}" boundary="_====_blah_====_$(date +%Y%m%d

Sending email with CC BCC and sender's address in unix mailx

血红的双手。 提交于 2019-12-07 03:34:09
问题 I want to send email from HP unix using mailx command. I have to include cc and bcc in my email and have to use the specific email address as the sender. But -r (which is to define the sender's email address) will disalbe ~ commands so if i have to define the sender's email address, i cannot use ~c and ~b commands for cc and bcc. Is there any work around???? cos these are the requirements from the user. Thanks. 回答1: Just re-order the arguments to mailx command. That would give the desired

How to send simple text file as attachment using HP-UX shell script?

99封情书 提交于 2019-12-06 01:35:00
I need to send an email with a text file as attachment using shell script in HP-UX; I don't have mutt installed. I am using following command but it sends the file content in body of email, I want it as an attachment. mailx -s "Report" name@example.com < file.txt I wrote this ksh function a few years ago # usage: email_attachment to cc subject body attachment_filename email_attachment() { to="$1" cc="$2" subject="$3" body="$4" filename="${5:-''}" boundary="_====_blah_====_$(date +%Y%m%d%H%M%S)_====_" { print -- "To: $to" print -- "Cc: $cc" print -- "Subject: $subject" print -- "Content-Type:

Sending email with CC BCC and sender's address in unix mailx

有些话、适合烂在心里 提交于 2019-12-05 10:50:59
I want to send email from HP unix using mailx command. I have to include cc and bcc in my email and have to use the specific email address as the sender. But -r (which is to define the sender's email address) will disalbe ~ commands so if i have to define the sender's email address, i cannot use ~c and ~b commands for cc and bcc. Is there any work around???? cos these are the requirements from the user. Thanks. Just re-order the arguments to mailx command. That would give the desired result $ echo "something" | mailx -s "subject" -b bcc_user@some.com -c cc_user@some.com -r sender@some.com

mailx change sender name

限于喜欢 提交于 2019-12-05 10:38:58
I understood that for changing sender's name with mailx I should do the following: mailx -r newmail@mail.com -s "some subject" my@email.com But when I do that, I get: mailx: invalid option -- r Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ... [-- sendmail-options ...] mail [-iInNv] -f [name] mail [-iInNv] [-u user Does anyone knows what's happening? thanks, The correct syntax is: mailx -s "some subject" my@email.com -- -r newmail@mail.com The Usage info shows "[-- sendmail-options ...]" and since "-r" is a sendmail option, you need to use the double dashes first. mailx