Take the 2-minute tour ×

I am trying to use Cygwin to send an e-mail from the command line. This is what I am putting in:

email -f myaddress@blah.com -s "This is a test" -b toaddress@blah.com

I get this error message:

/bin/sh: /usr/lib/sendmail: No such file or directory

I created a folder in /usr/lib called "sendmail", and now I get this:

/bin/sh: /usr/lib/sendmail: is a directory

Can someone please give me a step-by-step on how to send an email from Cygwin? Like how to set it up and everything? I have looked everywhere and I am about ready to tear my hair out.

EDIT: Thanks for your responses guys. This is how I finally got it to work.

bash.exe -c "echo  -e 'To: thepeopleimsendingitto@blah.com\nSubject: mySQL Upload\nSQL files from machines uploaded to log table successfully.' | sendmail -f me@blah.com otherpeople@blah.com"

Even though Cygwin was in my Windows path, it couldn't recognize it, so I had to run bash.exe directly and say "do this command as a Linux command". The echo is what is constructing the email itself. The \n characters separate it into "To", "Subject" and Body.

share|improve this question

closed as off topic by Will Jan 7 '13 at 14:56


what type of email server are you trying to connect to? connecting to an exchange server is rather difficult from what i've seen. –  nullrevolution Dec 13 '12 at 15:25
Yeah it's a Microsoft Exchange server. –  snowfi6916 Dec 13 '12 at 15:30
add comment

2 Answers

Okay So i wasn't clear enough on my first attempt... I guess that is my fault, I will try to make this more clear.

In the mail-config it will ask for the sendmail binary. It should sound something like this :

Please enter the sendmail command line [/usr/sbin/sendmail -t -i]:

This is basically asking where is the sendmail binary installed and what parameters should i pass it to send a mail. Your sendmail binary is either not installed, or not installed in the location you are specifying.

To see if you have sendmail installed try


If that works, to find the path of that binary try

%which sendmail; 

If that does not work, either sendmail is not installed, or the location of sendmail needs to be appended to the env path variable. There no correct answer on how you want to set things up, but the minimum requirments to make this work is to have sendmail on the current machine, have it configured and pass the correct absolute path to the mail program in the mail-config.

share|improve this answer
I have already run email-config. Didn't help at all. I have also read the man files and readmes, and I didn't find anything about this problem. Can you please provide me with a better answer than "find it yourself"? Because I have already spent hours on this. –  snowfi6916 Dec 13 '12 at 14:56
Okay, Ive tried to be more clear with my answer, I think my first one was pretty misleading when I reread it. –  gbtimmon Dec 13 '12 at 17:34
I have based my answer on yours. I think a little more explanation was in order. –  reinierpost Dec 13 '12 at 18:17
add comment

Apparently, email is a program that lets you submit an email message (a Mail Submission Agent) that relies on a another program to actually send the message (a Mail Transfer Agent).

I enabled this ability on my Cygwin installation last week. I am not using email but mutt, one of the alternatives Cygwin offers (see its package list). I use mutt not only to submit the mail to be sent, but also to read it; it's a Mail User Agent (see some screenshots).

Like email, mutt relies on a Mail Transfer Agent to send mail, so I had to install one. On Linux, popular choices are sendmail and postfix; but they do far more than you need and Cygwin doesn't offer them as packages. It does offer exim and ssmtp. I installed the ssmtp package and ran the ssmtp-config utility. You have to make some decisions here. You must know which SMTP server you can use and whether you need any special configuration to communicate with it. I found this unix.org forum thread helpful.

By the way, ssmtp does install an executable called sendmail, which is not the original sendmail, but behaves like it for the purposes you need it for.

share|improve this answer
add comment
