mailx

How to send HTML File in a e-mail Body unis Mailx or mail command

梦想的初衷 提交于 2020-04-18 05:48:18
问题 Is there a way to send html file into a mail body using mail or mailx command in Linux. I googled around and did not find anything that's working though there are many threads. on of the thread i see Mailx send html message but nothing works. What i used are below commands but not working as expected. $ mail -s "$(echo -e "This is Subject\nContent-Type: text/html")" kulfi@tap.com < OneView_Sheet.html $ mailx -s "$(echo -e "This is Subject\nContent-Type: text/html")" kulfi@tap.com < OneView

监控服务器:设置用户登录邮件提醒

白昼怎懂夜的黑 提交于 2020-03-02 07:14:38
Ubuntu上安装heirloom-mailx: sudo apt-get install heirloom-mailx 配置 sudo vim /etc/nail.rc 添加网易163邮箱开放的需要认证的smtp服务器: set from=用户名@163.com set smtp=smtp.163.com set smtp-auth-user=用户名 set smtp-auth-password=密码 set smtp-auth=login 等号两边不能有空格,被坑过 在用户的主目录下的.bashrc文件的最下面写上 echo '有人登录服务器' `date` `who` | mail -s "有用户登录服务器 `who | cut -d'(' -f2 | cut -d')' -f1`" 接收邮件的邮箱@qq.com 在命令行发邮件给QQ邮箱用户: echo "邮件内容" | heirloom-mailx -s "邮件标题" xxxxx@qq.com 来源: oschina 链接: https://my.oschina.net/u/1250198/blog/513639

How to insert name field in mailx

ぐ巨炮叔叔 提交于 2020-01-11 14:43:28
问题 My sample data File is $ cat /fullpath/myfile.csv a@gmail.com, A Singh k@gmail.com, K Singh I am using script.sh #!/bin/bash while IFS= read -r line do email=$(echo $line | awk -F, '{print $1 }') name=$(echo $line | awk -F, '{print $2 }') echo | mailx -v -s "Helo $name" -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from="xxxx@gmail.com(John Smith)" -S smtp-auth-user=xxxx@gmail.com -S smtp-auth-password=xxxxpassword -S ssl-verify=ignore -S

.dat attachment instead of text using mailx in RedHat Linux

非 Y 不嫁゛ 提交于 2020-01-02 04:42:08
问题 I am trying to send the contents of a text file as the body of an attachment. This works fine in HP-UX, but we've recently moved to RedHat Linux, and it is no longer working as expected. Here's my command cat test.txt | mailx -sTest me@email.ca If "test.txt" contains low ASCII characters, then it works fine. However, my text file may have French characters and will always contain a registered trademark symbol. It seems that when I try to send those characters, Linux is converting the email

Sending simple message body + file attachment using Linux Mailx [duplicate]

风流意气都作罢 提交于 2019-12-30 04:21:11
问题 This question already has answers here : How to attach a file using mail command on Linux? [duplicate] (13 answers) Closed last year . I am writing a shell script to send an email using Linux Mailx , the email must contain a file attachment and a message body . Currently sending an email with an attachment: output.txt | mail -s "Daily Monitoring" james@dell.com I wish to add a message body. How should i? Linux Mailx: mail [-eIinv] [-a header] [-b addr] [-c addr] [-s subj] to-addr 回答1: The

Calling Linux's “mailx” through java code: message-text always goes into attachment

你离开我真会死。 提交于 2019-12-24 08:26:24
问题 Since my SMTP provider has limit on number of emails that can be sent in a day, I wrote a Java code to call the "mailx" of Linux system, my java-program is running on. Here is that code: package sys.cmd; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; public class IntermediateJavaLinuxMailX { public static void main(String[]args) throws IOException{ email( new ArrayList

Can't figure out how to send ^D (EOT) signal to mailx in bash script

青春壹個敷衍的年華 提交于 2019-12-22 11:35:42
问题 I'm writing a bash script to send me an email automatically. Mailx requires an EOT or ^D signal to know the message body is over and it can send. I don't want to hit ^D on the keyboard when I run script which is what it does now. Here is my code: #! /bin/bash SUBJ="Testing" TO="test@test.com" MSG="message.txt" echo "I am emailing you" >> $MSG echo "Time: `date` " >> $MSG mail -s "$SUBJ" -q "$MSG" "$TO" rm -f message.txt 回答1: If you do not need to add more text and just need to send the

linux mail adding content type headers not working

风格不统一 提交于 2019-12-22 08:33:13
问题 i am using mail command to send mails from my linux system. The problem i am getting is the Content type of the mail is always as Content-Type: text/plain; charset=us-ascii . I am sending the html content and it is displaying as plain text. This is what i have tried 1) body="From: me@example.org To: me@gmail.com Subject: MIME Test Mime-Version: 1.0 Content-Type: text/html <html> <body> This is a test. </body> </html>"; echo $body| mail -s "testing purpose" reciever@gmail.com this didn't

mailx change sender name

拜拜、爱过 提交于 2019-12-22 06:48:02
问题 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, 回答1: The correct syntax is: mailx -s "some subject" my@email.com -- -r newmail@mail.com The Usage info shows "[--

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

那年仲夏 提交于 2019-12-20 01:36:18
问题 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