Send mail using mpack without attachment - shell

How can I send mail without attachment?
mpack -s 'SUBJECT' message.txt $To
This shows the message.txt file sometimes as a body while receiving mail and sometimes it shows file attachment while receiving the same mail. I need to show always text in this file as a mail body.

Related

How to send html mail with Content-ID header using mutt in command line

I was trying to send a html mail with images. But I am not familiar with mail headers, how can I add a image tag using cid, i.e. attach an image and make it shown in the html content?
<img src="cid:x">
This is my testing command:
mutt -s "test" jason#example.com \
-e "set content_type=text/html" \
-a /path/to/image <<MAIL
<img src="cid:0">
MAIL
It seems that this is a new feature onging in neomutt project.
Currently there's no way to add Content-ID header for attachments.
See PR: https://github.com/neomutt/neomutt/pull/2049.

How to download attachment from email using Robotframework

I want to download attachment from email in robotframework.But in imapLibrary there is not keyword defined for download attachment.
I can read email body but didn't fine any solution to download attachment
enter code here
open mailbox host=imap.gmail.com
user=abc#gmail.com
password = secret
${LATEST}=wait for email
sender=xyz#gmail.com timeout=10
${body} = get email body ${LATEST}
# log to console ${body}
# Remove String Using Regexp ${LATEST} [^WA ID]
convert to string ${body}
log to console ${body}
close mailbox
I want to download attachment from email in robotframework.But in imapLibrary there is not keyword defined for download attachment.

mailx not working but sendmail is working

Recently my production server has been upgraded. after that our mailx command is not working. it is sending the mail without attachment and then there is junk character in mail.
error is like.
Hello Team,
Please find the attached list of files which have been purged.
Regards,
Axiom Tech Support
begin 644 purge_files_2018-07-07.log.gz
M'XL("&,005L``W!U<F=E7V9I;&5S7S(P,3#M,#<M,#<N;&]G`-2=6V^<-Y*&
M[^=7]/4"M'DF*W>)DVQF,3/Q1#[V8K!H%,DJ6[`L"9*3&<^OGY=JM91(:K5R
ML=W?.#8LRVZ#1=;A>8N'_-V6U_CIK:LKE[ZR^&G_]ZO5R6>Y7+GY*U]]7OUR
MN;K0U>4O5^]E/?#SK\?IU?6KC]<?_O0?__<__K2Z^>_OSPS4?[5ZB\&=GK]?
MG7S]=C6'N%*1<;VZ.!MRM?K\#<]7KEK\R9?K`XWYN?&&^_&^.?EI&>/=,<?N
MJ3'_\.-//Y_\_QAVO!_VG_]V\N[KO[WY;O7?[WY:_=>/WYS<#EY/SV1AGO+4
MK/_YAS?+F?(_,.UG%^^?F.)TN!&_YLO+Z]?\S].+3VM\N?FJO,:XKE]?R]6O
the existing command was like
uuencode purge_files_2018-07-07.log.gz purge_files_2018-07-07.log.gz | mailx "Subject:Purge file";echo -e "\nHello Team,\n\nPlease find the attached list of files which have been purged -s onkar.tiwar90#gmail.com
now I have replaced it with
echo "Subject:Purge file";echo -e "\nHello Team,\n\nPlease find the attached list of files which have been purged.\n\nRegards,\nAxiom Tech Support";/usr/bin/uuencode purge_files_2018-07-07.log.gz purge_files_2018-07-07.log.gz)|/usr/sbin/sendmail -t "onkar.tiwar90#gmail.com"
So my question is why mailx is not working but sendmail is working. actually i will have to change in multiple scripts so I am seeking the solution.
Mailx upgrade switched it to use MIME as mail content instead of plain text. Your email client does not recognise uuencoded content within MIME.
You can stop using uuencode and switch to
mailx -a <filename>

Sender email using mailx and gmail SMTP cert

I wrote a pretty easy script to send some emails using mailx. The script is working fine but I'm trying to use a different sender email address and I've tried almost everything and is not working for me. I have the feeling that the gmail cert somehow is overwriting whatever I'm defining as the sender.
This is the code:
for i in ${EMAILS[#]}; do
mailx -s "Let me introduce myself" -r "Company <company#company.com>" -S replyto="company#company.com" $i <<eof
Hello World,
I'm an automate email
eof
done
Everytime that I recevie an email the sender email is "Company mypersonalgmail#gmail.com".
I've added this lines at the end of the main.cf file on /etc/postfix
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
And finally, I've created the /etc/postfix/sasl_passwd file with my personal gmail info (login+password).
Any kind of help would be much appreciated.
Thanks!
I've solved the issue. I've just added a new domain for my personal email account and now I can send emails with a different domain with the -r option.
This code also works:
echo "This is the message body and contains the message" | mailx -v -n -r "x#domain.com" -s "This is the subject" -S smtp="smtp.server:port" -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth-user="user#domain.com" -S smtp-auth-password="pasword" -S ssl-verify=ignore to_email#domain.com

How can I send an email from the command line using blat when the body contains carriage returns and line feeds?

I have a windows server which sends emails to me through a BASIC program. If the message body contains carriage returns/line feeds then the email never finishes. Only the first line is sent to me. I tried replacing them with \n but that didn't help as the email came to me with the \n in it. Any ideas?
Here is the command I'm using:
blat -to mike.roosa#toltsg.com -subject "[DEV] PO Detail Report" -body "Attached file
is ready for import.
From 01/01/09 to 01/29/09
PO Status not egual to 'C'" -attach "C:\TXT\PODetail_26879.csv" -log
C:\EMAIL.LOG\20090129.TXT -timestamp'.
If you want to do it all inline use the '|' character
-body 1st line|second line|third line
You can put the body in a text file and have blat send that:
blat [text file here] -to mike.roosa#toltsg.com -subject "[DEV] PO Detail Report" -attach "C:\TXT\PODetail_26879.csv" -log
C:\EMAIL.LOG\20090129.TXT -timestamp'
Just use Mail Alert Simple Mailer:
https://sourceforge.net/projects/mail-alert/
MailAlert.exe -r address#example.com -b "#Your_Directory\File_with_Mail_Body.txt"
You can also attach HTML file as an email body (remember to change PlaintextOnly=no in such a case).

Resources