Indunil Jayasooriya
2013-Jul-21 08:42 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
Hi, When no MTA is installed, How to send an email with a cronjob? I have below entrty in my cronjob? my /etc/cron.d/backup file looks like this. MAILTO=myemail at example.com 15 11 * * * root /root/scripts/backup.sh Can I send this email via SMTP server? Hope to hear from you. -- Thank you Indunil Jayasooriya http://www.theravadanet.net/ http://www.siyabas.lk/sinhala_how_to_install.html - Download Sinhala Fonts
Arun Khan
2013-Jul-21 09:27 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
On Sun, Jul 21, 2013 at 2:12 PM, Indunil Jayasooriya <indunil75 at gmail.com> wrote:> Hi, > > When no MTA is installed, How to send an email with a cronjob?Install postfix and configure to accept messages from 'localhost' only.> > MAILTO=myemail at example.comI guess you have a 'real' email id in your setup.> 15 11 * * * root /root/scripts/backup.sh > > Can I send this email via SMTP server?Some global service providers may accept email from the postfix MTA in your server. Alternately, you can configure postfix to relay the message via a 'smart_host' (preferred method). It will require you to provide a valid email address + plus password for your postfix (client) to do authenticate itself and send the outgoing message. There is ample documentation on the 'Net to accomplish this. -- Arun Khan
Indunil Jayasooriya
2013-Jul-21 10:18 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
> > > Can I send this email via SMTP server? > > > > > > You don't. > > You would have had to gone to some effort to not have an MTA > installed, as one is installed by default. Did you remove it (or > simply not configure it)? [they basically work for localhost > delivery without any changes.] > >CentOS 6 64 bit, zimbra is running with multi server setup. One mailbox and 2 mta servers. on mailbox server where no mta is installed, I want to backup mailboxes with a script. I have set it up to /etc/cron.d/backup file. After the backup, I want to an email to be sent to admin account. for the moment, I get an OUTPUT in this way. ( my /etc/cron.d/backup looks like this ) 35 13 * * * root /root/scripts/backup.sh > /tmp/backup.out 2>&1 I always login to the mailbox server and see the OUTPUT which is NOT so PERFECT.> You can't deliver to an "SMTP server" as, without an MTA, you have > no (real) way to talk to it. > > thanks for it. >> >-- Thank you Indunil Jayasooriya http://www.theravadanet.net/ http://www.siyabas.lk/sinhala_how_to_install.html - Download Sinhala Fonts
Fred Smith
2013-Jul-21 12:07 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
On Sun, Jul 21, 2013 at 02:12:55PM +0530, Indunil Jayasooriya wrote:> Hi, > > When no MTA is installed, How to send an email with a cronjob? > > I have below entrty in my cronjob? > > my /etc/cron.d/backup file looks like this. > > MAILTO=myemail at example.com > 15 11 * * * root /root/scripts/backup.sh > > Can I send this email via SMTP server? > > > Hope to hear from you.There is a tool named SendEmail, which is a perl script that performs the sending side (not receiving) of SMTP email handling. It's straightforward to use via commandline, which is exactly what you would want to use from a cron job: http://caspian.dotconf.net/menu/Software/SendEmail/ -- ---- Fred Smith -- fredex at fcshome.stoneham.ma.us ----------------------------- The eyes of the Lord are everywhere, keeping watch on the wicked and the good. ----------------------------- Proverbs 15:3 (niv) -----------------------------
Alexander Dalloz
2013-Jul-21 12:31 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
Am 21.07.2013 10:42, schrieb Indunil Jayasooriya:> Hi, > > When no MTA is installed, How to send an email with a cronjob? > > I have below entrty in my cronjob? > > my /etc/cron.d/backup file looks like this. > > MAILTO=myemail at example.com > 15 11 * * * root /root/scripts/backup.sh > > Can I send this email via SMTP server?If you decide a full blown MTA is too heavy weight in your environment on the different nodes (Postfix isn't the ideal choice for a so called null client), then have a look at ssmtp for example. It is provided by EPEL http://pkgs.org/centos-6-rhel-6/epel-x86_64/ssmtp-2.61-19.el6.x86_64.rpm.html It does exactly what you intend to do. There is another null client called msmtp http://msmtp.sourceforge.net/ but that one isn't available being packaged for CentOS.> Hope to hear from you.Alexander
Frank Cox
2013-Jul-21 16:43 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
On Sun, 21 Jul 2013 14:12:55 +0530 Indunil Jayasooriya wrote:> When no MTA is installed, How to send an email with a cronjob?I personally use this: http://www.cleancode.org/projects/email You can get a Centos rpm for that from my webpage: Centos 5: http://www.melvilletheatre.com/articles/el5/index.html Centos 6: http://www.melvilletheatre.com/articles/el6/index.html Note that the program isn't actually a mailserver. -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
Ben Mohilef
2013-Jul-21 18:49 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
> Hi, > > When no MTA is installed, How to send an email with a cronjob? > > I have below entrty in my cronjob? > > my /etc/cron.d/backup file looks like this. > > MAILTO=myemail at example.com > 15 11 * * * root /root/scripts/backup.sh > > Can I send this email via SMTP server? >The following script works for us to send notifications to a mobile "server" that can not process very long text messages. Unless you have perfect control over who is allowed to use this script and what is being sent, it is VERY bad security practice. Replace the bracketed setup stuff (inside <> ) with the appropriate sources and destinations. "$argv" passess the raw data to be transmitted. Depending on what's in the message, you may have to modify the 3rd through 6th lines. YMMV.> #!/usr/bin/expect > > set idx [string first \{ $argv] > set argv [string replace $argv $idx $idx] > set idx [string last } $argv] > set argv [string replace $argv $idx $idx] > > spawn telnet <destination> 25 > set send_slow {1 .01} > set timeout 180 > > expect { > -re "Escape character is" { > exp_send -s "helo <destination_domainname >\n" > exp_continue > } > -re "220" { > exp_send -s "mail from: <me at mydomain.com>\n" > exp_continue > } > -re "250.*ender" { > exp_send "rcpt to:<recipient at destination_domainname>\n" > exp_continue > } > -re "250.*ecipient" { > exp_send -s "data\n" > exp_continue > } > -re "354" { > exp_send -s "Subject: <Subject>\n\n" > exp_send -s "$argv\n" > exp_send -s ".\n" > puts "sending\n" > exp_continue > } > -re "Message" { > exp_send -s "quit\n" > } > -re "221" { > puts "done\n" > } > }
Joseph Spenner
2013-Jul-21 19:02 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
On Jul 21, 2013, at 1:42 AM, Indunil Jayasooriya <indunil75 at gmail.com> wrote:> Hi, > > When no MTA is installed, How to send an email with a cronjob? > > I have below entrty in my cronjob? > > my /etc/cron.d/backup file looks like this. > > MAILTO=myemail at example.com > 15 11 * * * root /root/scripts/backup.sh > > Can I send this email via SMTP server? > > > Hope to hear from you.There is a nifty perl script which does this, and can even do attachments: http://caspian.dotconf.net/menu/Software/SendEmail/ ______________________________________________________________________ If life gives you lemons, keep them-- because hey.. free lemons. "? Sticker" fixer: http://microflush.org/stuff/stickers/heartFix.html
Fred Smith
2013-Jul-21 21:28 UTC
[CentOS] When no MTA is installed, How to send an email with a cronjob?
On Sun, Jul 21, 2013 at 02:16:50PM +0200, Reindl Harald wrote:> > > Am 21.07.2013 14:07, schrieb Fred Smith: > > There is a tool named SendEmail, which is a perl script that performs the > > sending side (not receiving) of SMTP email handling. It's straightforward > > to use via commandline, which is exactly what you would want to use from > > a cron job: > > > > http://caspian.dotconf.net/menu/Software/SendEmail/ > > and it has a queue or is it so simple-minded only to work if > all is perfect and if the smtp server it uses is not reachable > messages are silently lost? > > hence for such things virtually everybody installs postfix with > a minimal configuration and edits /etc/aliases with whatever > full qualified target for rootI doubt it queues up mail, it's very simple and lightweight. It CAN be a useful tool for those who don't want a large and complicated program lurking there all the time. i've no clue how other mail handlers are configured, never having done it, but it for sure beats sendmail all hollow if all you want to do is send an occasional mail and can't wrap your mind around its configuration. Of course, no one is requiring you to use it. -- ---- Fred Smith -- fredex at fcshome.stoneham.ma.us ---------------------------- Do you not know? Have you not heard? The LORD is the everlasting God, the Creator of the ends of the earth. He will not grow tired or weary, and his understanding no one can fathom. ----------------------------- Isaiah 40:28 (niv) -----------------------------