public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Unable to send e-Mail from crontab in Cygwin
@ 2015-09-16 17:43 Shantaraman,Karthik
  2015-09-17 13:59 ` Nem W Schlecht
  0 siblings, 1 reply; 2+ messages in thread
From: Shantaraman,Karthik @ 2015-09-16 17:43 UTC (permalink / raw)
  To: cygwin

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

Thanks,
Karthik


--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Unable to send e-Mail from crontab in Cygwin
  2015-09-16 17:43 Unable to send e-Mail from crontab in Cygwin Shantaraman,Karthik
@ 2015-09-17 13:59 ` Nem W Schlecht
  0 siblings, 0 replies; 2+ messages in thread
From: Nem W Schlecht @ 2015-09-17 13:59 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-17 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16 17:43 Unable to send e-Mail from crontab in Cygwin Shantaraman,Karthik
2015-09-17 13:59 ` Nem W Schlecht

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).