Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
1 answers
8744 views
How to set mail subject using variable and ensure attachment is not included in email body
I have the following shell script fragment. var_name='ZZPCI' for emailadd in `cat /tmp/email_list.tmp` do subject_text="Subject with Var Name "$var_name subj_text_novar="Subject without Var Name" email_mssge="this is the message with variable name "$var_name echo "$email_mssge"|mailx -a /tmp/my_repo...
I have the following shell script fragment. var_name='ZZPCI' for emailadd in cat /tmp/email_list.tmp do subject_text="Subject with Var Name "$var_name subj_text_novar="Subject without Var Name" email_mssge="this is the message with variable name "$var_name echo "$email_mssge"|mailx -a /tmp/my_report.txt -s "$subject_text" "$emailadd" echo "$email_mssge"|mailx -a /tmp/my_report.txt -s "$subj_text_novar" "$emailadd" done What it does is a. Sets the variable var_name b. Reads through the list of email addresses stored in /tmp/email_list.tmp c. Compiles and sends an email with /tmp/my_report.txt (plain text file) as an attachment The script is intended to run on a number of different servers, so var_name will change with each server. The mail command with $subj_text_novar, (does not include $var_name in the subject string), sends the email correctly . However the mail command with $subject_text which does include $var_name places the contents of the attachment into the main body of the email. As far as I can make out, it is the actual $-sign causing the problem because hardcoding the var_name value into the string is fine but I don't see why because surely var_name is just a concatenated string So, how can I set the subject for mail so it includes $var_name and my text file is sent as an attachment? I am running this on SuSE 11.3 but the solution ideally needs to work on AIX 6.1 and HP UX11.31 as well Regards
Noj (1 rep)
Jul 21, 2015, 03:28 PM • Last activity: Jun 14, 2025, 07:05 PM
0 votes
1 answers
2542 views
Cannot send email via postfix / dovecot error status=deferred (mail transport unavailable)
I am trying to setup a mail server with postfix/dovecot/maria DB on centos 7 and have seem to hit a roadblock. I am not able to send emails to internal users and the logs suggest "mail transport unavailable". I checked few resources online and dont seem to find help, the services are up and running....
I am trying to setup a mail server with postfix/dovecot/maria DB on centos 7 and have seem to hit a roadblock. I am not able to send emails to internal users and the logs suggest "mail transport unavailable". I checked few resources online and dont seem to find help, the services are up and running. /var/log/maillog Mar 9 21:30:41 server postfix/qmgr: 2222637E93F: from=, size=472, nrcpt=1 (queue active) Mar 9 21:30:41 server postfix/qmgr: warning: connect to transport private/dovecot: No such file or directory Mar 9 21:30:41 server postfix/error: 2222637E93F: to=, relay=none, delay=0.14, delays=0.09/0.03/0/0.02, dsn=4.3.0, status=deferred (mail transport unavailable) Mar 9 21:34:53 server postfix/pickup: 59F6E2D66A4: uid=0 from= Mar 9 21:34:53 server postfix/cleanup: 59F6E2D66A4: message-id= Mar 9 21:34:53 server postfix/qmgr: 59F6E2D66A4: from=, size=472, nrcpt=1 (queue active) Mar 9 21:34:53 server postfix/qmgr: warning: connect to transport private/dovecot: No such file or directory Mar 9 21:34:53 server postfix/error: 59F6E2D66A4: to=, relay=none, delay=0.17, delays=0.12/0.03/0/0.03, dsn=4.3.0, status=deferred (mail transport unavailable) Mar 9 21:35:22 server postfix/qmgr: C47911FB57A: from=, size=476, nrcpt=1 (queue active) Mar 9 21:35:22 server postfix/error: C47911FB57A: to=, relay=none, delay=540, delays=540/0/0/0, dsn=4.3.0, status=deferred (mail transport unavailable) I need to find out the source of the error.
Atul (1911 rep)
Mar 10, 2017, 05:42 AM • Last activity: May 9, 2025, 12:04 PM
1 votes
2 answers
2604 views
Using mailx on Ubuntu 14.04.2
So I've installed mailx but I'm unable to get it to send an e-mail. I do the following: mailx -s "Test" To: myemail@email.com Cc: "This is a test." CTRL-D (does not work) CTRL-D does nothing. It's supposed to end the body and fire off the e-mail, but does not seem to be doing anything. Here's my /et...
So I've installed mailx but I'm unable to get it to send an e-mail. I do the following: mailx -s "Test" To: myemail@email.com Cc: "This is a test." CTRL-D (does not work) CTRL-D does nothing. It's supposed to end the body and fire off the e-mail, but does not seem to be doing anything. Here's my /etc/hosts file. I'm not sure if this is correct. 127.0.0.1 localhost localhost. hp-laptop hp-laptop. 10.XXX.X.XXX hp-laptop. Any suggestions on what's causing the issue? Thanks
Andrew Hummel (149 rep)
Jul 22, 2015, 03:47 PM • Last activity: Apr 14, 2025, 02:02 PM
1 votes
1 answers
3926 views
Mailx command to send the email to gmail account with content type as Content-Type: text/html
I have installed the mailx , on Red Hat Enterprise Linux Server release 7.2 Am able to send the mail successfully, with following command. **echo -e "Body content goes here ..." | mailx -v -r "sendermail_id@x.com" -s "subject content goes here" -S smtp=smtp://x.x.x.x receivermail_id@.com** Above com...
I have installed the mailx , on Red Hat Enterprise Linux Server release 7.2 Am able to send the mail successfully, with following command. **echo -e "Body content goes here ..." | mailx -v -r "sendermail_id@x.com" -s "subject content goes here" -S smtp=smtp://x.x.x.x receivermail_id@.com** Above command sends mail with plain text in the body **I want a command wherein i can send mail with html type content in the mail body. like bold letters, font colors......How do i do??? any help will be appreciated.**
sachin_ghagare (13 rep)
Mar 26, 2018, 05:22 AM • Last activity: Apr 12, 2025, 06:02 AM
2 votes
1 answers
2132 views
MBSync Maildir++ to IMAP with subfolder in INBOX
I am trying to use MBSync to sync a local Maildir++ folder (dovecot mail data) into a remote IMAP mailbox. While it works in general, subdirs of INBOX are ignored. Config looks like this: MaildirStore a-local Subfolders Maildir++ Inbox /var/kunden/mail/a/foo@bar.com IMAPAccount a Host *** User *** P...
I am trying to use MBSync to sync a local Maildir++ folder (dovecot mail data) into a remote IMAP mailbox. While it works in general, subdirs of INBOX are ignored. Config looks like this: MaildirStore a-local Subfolders Maildir++ Inbox /var/kunden/mail/a/foo@bar.com IMAPAccount a Host *** User *** Pass *** SSLType IMAPS CertificateFile ~/mail/cert IMAPStore a-remote Account a Channel a Master :a-local: Slave :a-remote: Patterns * SyncState ~/mail/a-imap-transfer Ouput looks like this (why is INBOX ignored?!) pattern '*' (effective '*'): Path, no INBOX Maildir warning: ignoring INBOX in /var/kunden/mail/a/foo@bar.com/ Opening slave store a-remote... Resolving ***... ok Connecting to *** (***:993)... Connection is now encrypted Logging in... Authenticating with SASL mechanism PLAIN... pattern '*' (effective '*'): Path, no INBOX Opening master box INBOX... Opening slave box INBOX... The folder structure in file system looks like this: .Drafts '.Entw&APw-rfe' .Gesendet .INBOX.abizeitung .INBOX.Bachelorarbeit .INBOX.bestellungen .INBOX.dav the last 4 of those are NOT synced. Any hints?
Nitek (121 rep)
Mar 29, 2020, 02:44 PM • Last activity: Feb 25, 2025, 02:57 PM
7 votes
4 answers
13639 views
HTML email from heirloom mailx on linux
I've been trying to work through sending a html email from mailx on a linux server. Few Notes: - I have to specify a smtp server so therefore I cannot use sendmail (This is not something I can change on my end) - I cannot install 3rd party things such as mutt. I will have to use mail or mailx - Sinc...
I've been trying to work through sending a html email from mailx on a linux server. Few Notes: - I have to specify a smtp server so therefore I cannot use sendmail (This is not something I can change on my end) - I cannot install 3rd party things such as mutt. I will have to use mail or mailx - Since my mail/x version is heirloom I do not have the --append or -a (attach header options) - not sure if this helps at all but my linux distro is 7.3 (Maipo) What I've seen in most posts on stackoverflow for my case: mailx -v -S smtp=SERVER -s "$(echo -e "This is the subject\nContent-Type: text/html")" -r FROM TO Content-Disposition: inline Message-ID: User-Agent: Heirloom > mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; > charset=us-ascii Content-Transfer-Encoding: 7bit Hello World Try 2: So I do not want the headers printed out in the body. So I tried to remove the Content-Disposition: inline mailx -v -S smtp=SERVER -s "$(echo -e "This is the subject v2\nContent-Type: text/html\nMIME-Version: 1.0")" -r FROM TO ` > Hello World > ` Try 3: Tried flip flopping content-type and mime-version mailx -v -S SERVER -s "$(echo -e "This is the subject v3\nMIME-Version: 1.0\nContent-Type: text/html")" -r FROM TO X-Priority: 1 (Highest) Message-ID: User-Agent: Heirloom mailx > 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello World After all of this, I've tried many other adaptations of the above tries but they led to no new output. So any suggestions or ideas are gladly accepted! Please keep in mind my constraints listed above...I know they limit my options but that's out of my control. thanks for your time!
FzZB03KCa46QeaU (91 rep)
Aug 7, 2017, 04:45 PM • Last activity: Jan 17, 2025, 06:09 AM
0 votes
1 answers
272 views
mailx not sending to Outlook distribution list?
So I have a Solaris 11 server with mailx. I am trying to send emails to distribution lists in the company's Outlook (which is not running on this server, it runs on Microsoft's cloud). I am able to send emails to individuals without trouble. Then I am able to send emails to SOME distribution lists,...
So I have a Solaris 11 server with mailx. I am trying to send emails to distribution lists in the company's Outlook (which is not running on this server, it runs on Microsoft's cloud). I am able to send emails to individuals without trouble. Then I am able to send emails to SOME distribution lists, but not others. A coworker of mine who has been here a long time told me there was "some setting in Outlook" that allows mailx to send to distribution lists. Other people have told me I need to set up an alias file (I've checked the alias file on the server, it is empty, so that does not explain why some distribution lists are working but not others). By "not working" I mean just that- the emails don't send. They appear in /var/log/syslog without errors. But the emails are never received. I'm at a loss as to what to do. Any help at all is appreciated.
bk_32 (111 rep)
Aug 1, 2024, 02:46 PM • Last activity: Aug 1, 2024, 05:24 PM
2 votes
6 answers
35060 views
how to send a mail with attachment using sendmail command in unix
This is how I try to send, email with sendmail command. echo "Dear user, please find the attached file. Thanks, Support team " | mailx -s "x12 extract for 837 transaction" -a $LogFilePath/file.csv $email_id but i am getting the error as "-a illegal operation" checked with man mailx command there is...
This is how I try to send, email with sendmail command. echo "Dear user, please find the attached file. Thanks, Support team " | mailx -s "x12 extract for 837 transaction" -a $LogFilePath/file.csv $email_id but i am getting the error as "-a illegal operation" checked with man mailx command there is no flag like -a and there flag for attachment. so I have tried with sendmail command ( echo $email_id #From: $email_from_recipients echo "MIME-Version: 1.0" echo "Content-Type: text/html; charset=us-ascii" echo Subject: Report $LogFilePath/file.csv ) | /usr/lib/sendmail -t it was not sending the file as attachment. the contents of the csv file is displayed in the body of the mail with comma separated one. how to send the attachment with sendmail command in unix?
Kalishwari (41 rep)
May 3, 2018, 04:40 AM • Last activity: Jun 11, 2024, 05:04 PM
1 votes
1 answers
180 views
While sending mail, the body of the mail lines are getting merged in unix
I have to send an email from my development server, the mail body is having some 20 lines. But Few lines are getting merged. I have tried no of scenarios (used mailx,mail & sendmail also) to avoid this, but still the lines in body mail are getting merged. $ cat check.txt Company*+ ! 1000000001!: Glo...
I have to send an email from my development server, the mail body is having some 20 lines. But Few lines are getting merged. I have tried no of scenarios (used mailx,mail & sendmail also) to avoid this, but still the lines in body mail are getting merged. $ cat check.txt Company*+ ! 1000000001!: Global Operations Last Name* ! 1000000018!: Global Operations First Name* ! 1000000019!:Generic **command used to send this mail:** mailx -s "FAILURE" < check.txt "abc@gmail.com" **Received Output in mail:** Company*+ ! 1000000001!: Global Operations Last Name* ! 1000000018!: Global Operations First Name* ! 1000000019!:Generic Let me know if I am doing any wrong in the code.
user609203 (11 rep)
Apr 29, 2024, 06:47 AM • Last activity: Apr 29, 2024, 07:04 PM
4 votes
3 answers
8404 views
How to configure mailx to support Gmail?
How can I set up `mailx` to send messages to my Gmail account? What I do now is run the command: mail -s "hello kid" mymail@gmail.com It freezes and does nothing. I tried some variations, but all of them just froze dead in my terminal. Is there anything I need to configure in `mailx` before actually...
How can I set up mailx to send messages to my Gmail account? What I do now is run the command: mail -s "hello kid" mymail@gmail.com It freezes and does nothing. I tried some variations, but all of them just froze dead in my terminal. Is there anything I need to configure in mailx before actually using mail? There were different options found on the Internet, like making a .mailrc and other config files, but I got nowhere. Can someone provide me with more information on the subject?
eeer (43 rep)
Mar 28, 2012, 06:40 PM • Last activity: Mar 11, 2024, 05:48 AM
0 votes
1 answers
374 views
mailx command in Linux
The below code is working fine in a Unix server for sending mail along with attachments from an array variable, i.e DISCARDED_FILE_NAME, but the same code is not working in Linux server, since `-m` in mail command is not supported in Linux; instead of it we need to use `-a`. I have tried with it as...
The below code is working fine in a Unix server for sending mail along with attachments from an array variable, i.e DISCARDED_FILE_NAME, but the same code is not working in Linux server, since -m in mail command is not supported in Linux; instead of it we need to use -a. I have tried with it as shown below, but it is still not working. This code is working fine in a Unix server without any issue:
=$1
set -A DISCARDED_FILES $2
DISCARDED_FILE_NAME="DISCARDED"
echo "MRP_NAME" ${MRP_NAME}
RECEIVER="xyz@gmail.com"
echo "RECEIVER" ${RECEIVER}
SUBJECT="Error on ${MRP_NAME}"
BODY="Errore nell' elaborazione dell' ${MRP_NAME} Controllare file ${DISCARDED_FILE_NAME}"
echo "${BODY}"
(echo "$BODY\n";
for file in ${DISCARDED_FILES[@]}
do
uuencode $file echo $file | cut -d'/' -f9
done ) | mailx -m -s "${SUBJECT}" ${RECEIVER} 
echo mail sent
I modified accordingly to work in a Linux server but failed as shown below : This code is not working in a Linux server:
MRP_NAME=$1
set -A DISCARDED_FILES $2
DISCARDED_FILE_NAME="DISCARDED"
echo "MRP_NAME" ${MRP_NAME}
RECEIVER="xyz@gmail.com"
echo "RECEIVER" ${RECEIVER}
SUBJECT="Error on ${MRP_NAME}"
BODY="Errore nell' elaborazione dell' ${MRP_NAME} Controllare file ${DISCARDED_FILE_NAME}"
echo "${BODY}"
(echo "$BODY\n";
for file in ${DISCARDED_FILES[@]}
do
uuencode $file echo $file | cut -d'/' -f9
DISCARDED_FILES+=( "-a"  $file)  
done ) | mailx "${DISCARDED_FILES[@]}" -s "${SUBJECT}" ${RECEIVER} 
echo mail sent
When I ran the above code in Linux server I got the below text in mail (body) without any attachments.
Errore nell' elaborazione dell'  Controllare file DISCARDED\n
begin 660 shell.txt
3=F%R=6X@:70@:7,@:6X@8F]D>0
end
begin 660 MoneticalBatchExtlogs.txt
M9&-T97)I;#`Q.B]A'0O;&]G+T)312,@
M'0@35)0,#$@](#(Q.#X"ELQ-3HP-SHQ-UT@16YD
M(&=E;F5R871I;F<@N+BX*6S$U.CW
M.C$W72!3=&%R="!I;G-E
Naga Sai Varun (1 rep)
Sep 20, 2020, 12:47 PM • Last activity: Jan 31, 2024, 07:51 AM
3 votes
1 answers
128 views
Uucp: copy...but not command execution allowed
I have setup a Unix machine with uucp (Unixware) connected via direct serial to Slackware machine. Using uucp. The copy works on Unixware uucp -m /usr/bin/view Slackware1\!/var/spool/uucppublic mailx .... ..... Content-Type: text/plain; charset=us-ascii Status: R Content-Length: 121 REQUEST: unixwar...
I have setup a Unix machine with uucp (Unixware) connected via direct serial to Slackware machine. Using uucp. The copy works on Unixware uucp -m /usr/bin/view Slackware1\!/var/spool/uucppublic mailx .... ..... Content-Type: text/plain; charset=us-ascii Status: R Content-Length: 121 REQUEST: unixware2!/usr/bin/view --> Slackware1!/var/spool/uucppublic (myusername) (SYSTEM: Slackware1) copy succeeded Now we try the mailx on remote and.. echo something|uux -z Slackware1\!/usr/bin/mailx myuser On Slackware server the uucp log said.. ERROR: Not permitted to execute /usr/bin/mailx Of course the mail don't arrive. Those are the permission configuration On Linux /etc/uucp/sys remote-send ~ remote-receive ~ local-send ~ local-receive ~ command-path /usr/bin commands ls mailx system unixware2 time any port serial1 speed 38400 chat in:--in: nuucp word: *** on unixware /etc/uucp/Permissions LOGNAME=nuucp \ MACHINE=OTHER \ READ=/var/spool/uucppublic \ WRITE=/var/spool/uucppublic \ SENDFILES=call REQUEST=yes \ COMMANDS=/usr/bin/rmail:/usr/bin/mailx \ PUBDIR=/var/spool/uucppublic \ MYNAME=unixware2 \ VALIDATE=Slackware1 LOGNAME=myusername \ MACHINE=OTHER \ READ=/var/spool/uucppublic \ WRITE=/var/spool/uucppublic \ SENDFILES=call REQUEST=yes \ COMMANDS=/usr/bin/rmail:/usr/bin/mailx \ PUBDIR=/var/spool/uucppublic \ MYNAME=unixware2 \ VALIDATE=Slackware1 any suggestion?Thanks edit1: Trying uux -a nuucp.. make the same error
elbarna (13690 rep)
Dec 10, 2023, 05:07 AM • Last activity: Dec 10, 2023, 05:37 AM
1 votes
3 answers
4084 views
Install Postfix using Mailutils on Ubuntu 19.04 server for sending out mail only
I followed this tutorial: https://computingforgeeks.com/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-18-04-lts/ I'm trying to setup a send only mail from my Ubuntu 19 server. I followed the guide above and tried to install mailutils using: ``` apt install mailutils ``` I...
I followed this tutorial: https://computingforgeeks.com/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-18-04-lts/ I'm trying to setup a send only mail from my Ubuntu 19 server. I followed the guide above and tried to install mailutils using:
apt install mailutils
It installed something but I'm not sure what as the mailutils command doesn't work as seen here: enter image description here enter image description here I then installed via the following command:
apt install libmailutils-dev
That worked as mailutils command now runs, but I didn't get a GUI interface to select like how the guide shows it: enter image description here - What do I need to do now since the Postfix install GUI didn't popup according to the guide? - Also is it an issue if I installed mailutils and then libmailutils-dev?
Patoshi パトシ (1855 rep)
Aug 6, 2019, 09:06 PM • Last activity: Nov 25, 2023, 01:34 PM
0 votes
1 answers
2662 views
send multiple files as mail though mailx command
I have 3 file names present inside a .txt file I have to read all file names and send them as a attachment in a mail. Example: test.txt - (file name) -query1.dat -query2.dat -query3.dat I have to read test.txt file and get all those query*.dat files and send a mail with all those files as attachment...
I have 3 file names present inside a .txt file I have to read all file names and send them as a attachment in a mail. Example: test.txt - (file name) -query1.dat -query2.dat -query3.dat I have to read test.txt file and get all those query*.dat files and send a mail with all those files as attachment using mailx command. I have this code:
while read line
do

    mailx -a ${line} -s "files" ${mail_from} << EOM

    Hi, Sent files

    EOM

done
It sends each file seperately in a seperate mail. I need to send all these files in a single mail. How to do that?
Venkatesha Prasad S (1 rep)
Jun 21, 2022, 10:58 AM • Last activity: Nov 15, 2023, 05:03 PM
5 votes
2 answers
1599 views
Light program (mini MTA?) for system mail (only sending/relay via external server with unattended-upgrades, cron, smartmontools, etc.)
I've come across different names in different places: Light MTA, Remote MTA, Smarthost, etc. Generally, I do not want to install a full-fledged mail server (such as `sendmail`, `postfix`, `exim`), but only send notifications/emails using an existing external ISP/mail provider (such as dismail.de, ma...
I've come across different names in different places: Light MTA, Remote MTA, Smarthost, etc. Generally, I do not want to install a full-fledged mail server (such as sendmail, postfix, exim), but only send notifications/emails using an existing external ISP/mail provider (such as dismail.de, mailfence.com or others) with unattended-upgrades, cron, smartmontools, my own bash scripts etc from all over the system. Additionally, it would be ideal if there was support for queuing and retrying (an attempt to resend in the event of being offline or temporarily unreachable by the mail provider) So far I've found: - ssmtp - msmtp - s-nail - nullmailer - dma - esmtp But I didn't find any comparison between them. 1. Does anyone know what makes the program stand out from the rest? (positives, negatives, ease of configuration, low resource consumption, etc.) 2. Possibly I missed something and maybe there is another one, better than all those mentioned for Debian? 3. Did I understand correctly that s-nail is also an MUA and bsd-mailx or mailutils is not needed? Maybe others too?
DarekH (157 rep)
Sep 18, 2023, 03:47 PM • Last activity: Sep 21, 2023, 04:18 PM
1 votes
1 answers
1010 views
How to include a display name when sending mail with mailx
I'm sending email from a script using mailx. The script is run daily by systemd, using .service and .timer files. For testing purposes I'm sending from the command line. The mail is sent with the command echo "Test message - you know the drill" | mailx -r "localweb@example.uk" -s "Test Message" a.us...
I'm sending email from a script using mailx. The script is run daily by systemd, using .service and .timer files. For testing purposes I'm sending from the command line. The mail is sent with the command echo "Test message - you know the drill" | mailx -r "localweb@example.uk" -s "Test Message" a.user@example.com (personal data replaced for privacy) This works. It's relayed by postfix to my gateway server (also postfix) which signs the outgoing message. This is then delivered to GMail which verifies the SPF data and DKIM signature, and the message is delivered to my inbox. This is good, except it's displayed as Ubuntu I have other servers sending mail by the same method, and they all display similarly. I'd like to change the display name to something more useful, per server. For example, Web Server but something I'm doing is messing up the From address as it travels to the gateway server. I've tried echo "Test message - you know the drill" | mailx -r "Web Server localweb@example.uk" -s "Test Message" a.user@example.com and echo "Test message - you know the drill" | mailx -r "Web Server " -s "Test Message" a.user@example.com But in both cases the From address is somehow lost by the local PostFix, and the message sent to the gateway server has a from address of localweb@smtp.private.example.uk where smtp.private.example.uk is the FQDN of the gateway server. This is sent to GMail, but fails the SPF and DKIM tests and is unceremoniously dumped in spam as a result. (I don't know how the local postfix is getting the name of the gateway server) So, how can I add the display name to the parameters I pass to mailx such that it survives the journey from server to server and is displayed correctly by GMail? Mailx version 3.14 (GNU Mailutils) Ubuntu 22.04 I've made only one change to main.cf for PostFix: added a relay-host address for the gateway server.
CatchAsCatchCan (113 rep)
Sep 4, 2023, 08:40 AM • Last activity: Sep 4, 2023, 10:14 PM
-1 votes
1 answers
1882 views
Generating .XLS file as an output file of sqlplus query and sending that .XLS file as an attachment in email
I am generating output file (.xls format) from the below DB query- sqlplus -S -L user/pass@DB > home/test/query_output.xls set line 22000 set head off set feedback off SELECT * from table; EOF The `query_output.xls` file contains records as below- VIM 00 34562356 22412299 Dated 11-JUN-18 OMM sansra...
I am generating output file (.xls format) from the below DB query- sqlplus -S -L user/pass@DB > home/test/query_output.xls set line 22000 set head off set feedback off SELECT * from table; EOF The query_output.xls file contains records as below- VIM 00 34562356 22412299 Dated 11-JUN-18 OMM sansra carla Yes No No No 02356478 14-SEP-18 To send this query_output.xls file as an attachment in email, I am using below- uuencode home/test/ query_output.xls | mailx -s "Subject" me@Domain.com Also tried uuencode query_output.xls query_output.xls | mailx -s "Subject" me@Domain.com But not getting the data in attachment received in email. Also tried mailx -a and mutt but its showing 'illegal option -- a' and 'command not found' resp. mailx -a home/test/query_output.xls -s "Subject" me@Domain.com < /dev/null mutt -a query_output.xls query_output.xls < /dev/null also tried mailx -s "Subject" me@Domain.com < query_output.xls but no attachment received. Could you please help?
Praveen Verma (123 rep)
Jun 13, 2018, 10:26 PM • Last activity: Aug 21, 2023, 07:05 PM
1 votes
1 answers
355 views
"mailx -a x.txt ..." hangs, while "cat x.txt | mailx..." works
As described in the subject, `mailx -a somefile.txt -s "blah blah" myaddress@bigcorp.com` hangs, while emails sent via `cat somefile.txt | mailx -s "blah blah" myaddress@bigcorp.com` arrive. The `/etc/postfix/main.cf` `relayhost` variable is set to our corporate mail server. In a certainly related n...
As described in the subject, mailx -a somefile.txt -s "blah blah" myaddress@bigcorp.com hangs, while emails sent via cat somefile.txt | mailx -s "blah blah" myaddress@bigcorp.com arrive. The /etc/postfix/main.cf relayhost variable is set to our corporate mail server. In a certainly related note, mail sent via mutt (with smtp_url pointing to the same corporate mail server as the postfix relayhost) seemingly disappears into the bit bucket. echo "" | mutt -s "this is a test" myaddress@bigcorp.com This all was working perfectly until late last month. None of the files in /etc/postfix have changed in 2+ years, so I wonder if the mail server was reconfigured.
RonJohn (1421 rep)
May 31, 2023, 11:21 AM • Last activity: May 31, 2023, 01:11 PM
0 votes
1 answers
11968 views
How to mailx working with Content-Type: text/html
I've to send a HTML file with mailx command but when I receive the email with the mark up code showed like this : Title One /TITLE> body { width:900px; font-size: 10pt; font-family:verdana; .../... I used this command : cat file.html | mailx -r dude1@acme.com -s "Suject" -S content_type=text/html -S...
I've to send a HTML file with mailx command but when I receive the email with the mark up code showed like this : Title One /TITLE> body { width:900px; font-size: 10pt; font-family:verdana; .../... I used this command : cat file.html | mailx -r dude1@acme.com -s "Suject" -S content_type=text/html -S smtp=smtp.acme.com dude2@acme.com I tried this one too cat file.html | mailx -a 'Content-Type: text/html' -r dude1@acme.com -s "Suject" -S content_type=text/html -S smtp=smtp.acme.com dude2@acme.com I got this error message with this last one above : Content-Type: text/html: No such file or directory What is missing in the -a option ?
dubis (1480 rep)
Jan 6, 2023, 05:20 PM • Last activity: Apr 20, 2023, 09:07 AM
0 votes
1 answers
839 views
send e-mail with mailx in a bash script waiting if needed for the outcome
I'm writing a bash script that sends an e-mail with attachment to the local user root. I noticed that `mailx` forks some helper program and terminates instantly with exit status 0 even when the command line arguments are invalid: ``` localhost:~/basinsrv # mailx -s aaa root -a bbb </dev/null ; echo...
I'm writing a bash script that sends an e-mail with attachment to the local user root. I noticed that mailx forks some helper program and terminates instantly with exit status 0 even when the command line arguments are invalid:
localhost:~/basinsrv # mailx -s aaa root -a bbb 
How to make mailx wait for the outcome and terminate with proper error code? Actually, I need to post-process the generated mail before it's sent. Is it possible to not actually send the message and only save it to a file? mailx-12.5-31.7.x86_64 postfix-3.6.2-7.1.x86_64
basin (2121 rep)
Feb 8, 2023, 07:56 PM • Last activity: Feb 8, 2023, 10:17 PM
Showing page 1 of 20 total questions