From: Nem W Schlecht <nemws1@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Unable to send e-Mail from crontab in Cygwin
Date: Thu, 17 Sep 2015 13:59:00 -0000 [thread overview]
Message-ID: <CA+2x6-+EAX_4fbKb8n-QdpU-7TmFT2nCvj-YJ=xTBxrcHKLnPA@mail.gmail.com> (raw)
In-Reply-To: <f248e7c31a3cb92535ca59b111b88eea@ufl.edu>
On Wed, Sep 16, 2015 at 12:43 PM, Shantaraman,Karthik
<k.shantaraman@ufl.edu> wrote:
> Hi,
> I have set up cygwin in my Windows Vista machine and have configured cron by
> running the cygrunsrv command.
>
> I am trying to send an automated mail everyday with cron but it is not
> working out. Could you help me with this?
>
> #Borrowed from anacron
> SHELL=/bin/bash
> PATH=/usr/sbin:/usr/bin
> USER=karthik.techvs@gmail.com
> MAILTO="karthik.techvs@gmail.com"
> #End borrowed from anacron
>
> 15 10 * * * sendmail /USER=karthik.techvs@gmail.com
> "karthik.techvs@gmail.com" testmail
>
>
> I have installed the ssmtp package also after i researched about this
> online.
>
> But it says :
>
> $ ssmtp-config
> -bash: ssmtp-config: command not found
This is, oddly, not very easily found/well documented when you do
Google searches for 'cygwin cron sendmail'.
cron on cygwin installs a symlink to /usr/bin/cronlog as
/usr/sbin/sendmail on installation. This is a good thing. This
script creates a file named 'cron.log' in your home directory for any
cron command outputs. If you look at it, you'll notice many
sendmail-like headers in the file.
To have cron actually send emails, you need to set up
/usr/sbin/sendmail as a link (or a program) to something that actually
sends mails.
I'm using msmtp, but I'm guessing ssmtp will be similar.
Steps:
1) Remove the link /usr/sbin/sendmail
2) Create a new shell script or link in its place
So:
rm /usr/sbin/sendmail
ln -s /usr/bin/msmtp /usr/sbin/sendmail
(Note - use a decent editor instead of cat ... Control-D)
I just installed 'msmtp' on a new install and ran 'msmtp-config'. If
/usr/sbin/sendmail does *not* exist (ie, you install msmpt *before*
cron) then it will create this link for you.
Once you do all this, edit your crontab and put an entry in it like this:
* * * * * date
And reload (if you didn't do a 'crontab -e' to edit)
It may take up to 2 minutes for cron to start doing stuff, as the
minute in runs it'll load in the new crontab and then the *following*
minute, it will run 'date' and should e-mail it to.
Once you start getting e-mails, just comment this line out or delete it.
--
Nem W Schlecht
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
prev parent reply other threads:[~2015-09-17 13:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-16 17:43 Shantaraman,Karthik
2015-09-17 13:59 ` Nem W Schlecht [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+2x6-+EAX_4fbKb8n-QdpU-7TmFT2nCvj-YJ=xTBxrcHKLnPA@mail.gmail.com' \
--to=nemws1@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).