I am vikas. i am looking a command that can send mail from zimbra mail-store server to external world. but as i checked in zimbra not getting Any program that have role of sending mails. that is why i am relay email through Zimbra MTA server. now i am going to use below command but still getting variable error.
awk 'BEGIN{print "Subject:test mail!\nFrom:Mailadmin <admin#knowledgelinux.com>"}{printf("%s\015\n", $0)}' $message file-name=/test.txt | sendmail -t "mail#knowledgelinux.com"
awk: command not found
The instructions here worked for me:
vim /etc/logwatch/conf/logwatch.conf
Relevant lines to be replaced:
Output = mail
MailTo = root_all#your.domain
MailFrom = Logwatch#your.domain
mailer = "/opt/zimbra/common/sbin/sendmail -t"
Zimbra uses a modified version of sendmail.
The Zimbra MTA uses a modified postfix daemon. You should be able to just use the command mail:
cat *messagefilename* |mail -r *fromaddress* -s *Subject* *recipient-list*
As long as the Zimbra MTA is running on the machine in question this should work.
Related
I have created a service that is supposed to send an automated email in HTML format by using UNIX mail command. It was working correctly until yesterday when suddenly stopped sending mails.
This is the command Im running programmatically
cat ./email.txt | mail -v -s "$(echo -e "Report for Last Week
Content-Type: text/html
Reply-to: abraham#corp.com
From: abraham#corp.com")" abraham#corp.com manolo#corp.com
The output looks like:
abraham#corp.com... queued
manolo#corp.com... queued
I am not getting any email, neither my partner...
I am not even able to run
echo "test"|mail -s "This is a test" abraham#corp.com
Im running on RedHat Linux.
Just in case someone needs help. The issue was related to the sendmail service of the OS.
I had to go service sendmail restart
It was as simple as that, however, I did compare the configuration files against a clean machine to make sure they were similar.
I use logrotate that sends me logs on a regular basis. My server is a VPS running Postfix as an outgoing-only SMTP server.
I would like all the mailed logs (which Logrotate sends) to be encrypted with PGP or S/MIME. How can I do that?
I searched for logrotate mail encryption, but couldn't find any. Therefore, I'm thinking that I can pass "nomail" command in logrotate config, but then add in the "postscript" a script to first encrypt the mail and then send.
So, is there a better way to encypt logrotate mail with PGP? Or that's what I need to do? I would appreciate any advise or an example of such a script.
Also, I'm not considering to use TLS as there are possible ways to bypass it in the SMTP server. And I would rather rely on encryption of individual messages.
Thanks!
Edit:
Here is my script I'm using for custom email sending(Without GPG for now):
#!/bin/bash
read MSG
echo $MSG | mail -s $1 $2
But when I force rotate with logrotate --mail=loggpg.sh --force /etc/logrotate.d/ufw I keep getting error about uncompression, do I need to manually uncompress it? Or there is smth wrong with the script?
Error I get:
error: mail command failed for /var/log/ufw.log.5.gz
error: uncompress command failed mailing /var/log/ufw.log.5.gz`
You can execute logrotate with --mail command line option. It will allow you to use your own shell/perl/python script to send email instead of default /bin/mail -s.
man logrotate
OPTIONS
...
-m, --mail
Tells logrotate which command to use when mailing logs. This command should accept two arguments: 1) the subject of the message, and
2) the recipient. The command must then read a message on standard input and mail it to the recipient. The default mail command is
/bin/mail -s.
I have tried to send thousands of emails through running a csh script to execute the "mail" command. But all my emails were blocked by the recipient. I was told that the blocking reason is because of the workstation domain (kichisatoru#Sky.local), which is not a real domain (e.g. xx#gmail.com). How can I fix this issue, so the recipient can receive my emails in the standard way?
My csh:
#!/bin/csh
foreach eml (`ls *.eml`)
mail recipient#edu < $eml
echo $eml sent...
end
My problem is fixed! I have found a very detailed manual online http://www.developerfiles.com/how-to-send-emails-from-localhost-mac-os-x-el-capitan/
I have set the from: email-id in .muttrc. I am using the following command to send an e-mail from command-line:
echo "<html><body><b>BOLD</b></body></html>" | mutt -e "set content_type=text/html" -s "HTML" -- xyz#gmail.com
I am able to send e-mail from only my home internet. If I try to send from any other network, it doesn't go. How should I fix this to be able to send e-mail from any network? What all changes are supposed to be made?
I am using the mail command of unix in a perl script. I specify the 'to', 'cc', 'subject' and 'body' of the mail. I do not specify the from address. Where is the from address picked from? Pls help
There are portable libraries for handling email as daxim and David W mention, but if you want a quick fix, this works under linux if your mail command uses bsd-mailx (as it does on my machine)...
#!/usr/bin/env perl
$BODY = "Hello self";
$RECIPIENT = "destination\#email.local";
$FROM = "mike\#localhost";
$SUBJECT = "some subject here";
$CMD = qq(echo "$BODY" | mail -a "From: $FROM" -s $SUBJECT $RECIPIENT);
exec($CMD);
If you have more questions about the unix mail command, try man mail from your shell prompt.
The mail command on most system nowadays is Heirloom mailx. It claims compatibility with POSIX, so the information I give here should be good for any well-behaving mail command.
The From address is set by:
either the user#domain as returned by the appropriate POSIX system calls (see shell commands whoami and domainname -f for a different way to access them)
or set by the from environment variable
or set by the -r command line option (going to be deprecated?)
Obligatory Clippy: Hi! I see you are trying to send mail from Perl. Did you mean to use Email::Sender/Email::Simple instead?
Don't use the mail command linecommand! Use Net::SMTP.
The mail command may not even be configured on a particular system, and it won't work on Windows. Meanwhile, Net::SMTP is a standard Perl module that should be available on all systems.
Never used it before? Read the documentation and try it out. That's how you learn.