So I am trying to use sendmail in cygwin because on the server I cannot use other options like mutt because they aren't supported. I have downloaded the sendmail package during the cygwin setup, but when I try to run my code it says sendmail command not found.

This is my code I am trying to run in cygwin:

uuencode /somefilepathtoattachment | echo -e "to:  blahblah@email.com\ncc: blahblah@email.com\n\nAttached is a zip folder containing the reports for the snapshots" | sendmail -t -f someemail@email.com -s "Daily Snapshot Reports"

From some googling I tried to figure out the problem but I am stumped. When I ran "whereis sendmail" I got this:

sendmail: /usr/sbin/sendmail /usr/lib/sendmail /usr/libexec/sendmail.exe /usr/share/sendmail /cygdrive/c/Windows/system32/sendmail.dll

When I ran "which sendmail" I got this:

which: no sendmail in (/usr/local/bin:/usr/bin:/cygdrive/c/Oracle/product/12.1.0/client_2:/cygdrive/c/Oracle/product/12.1.0/client_2/bin:/cygdrive/c/Program Files/jdk11.0.11_9/bin:/cygdrive/c/Program Files/apache-maven-3.8.1/bin:/cygdrive/c/HIS13/SysWOW64:/cygdrive/c/HIS13/system:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/OpenSSH:/cygdrive/c/Program Files (x86)/Sennheiser/SoftphoneSDK:/cygdrive/c/Program Files (x86)/Webex/Plugins:/cygdrive/c/Program Files/Common Files/Oracle/Java/javapath:/cygdrive/c/Program Files/WinMerge:/cygdrive/c/php:/cygdrive/c/Program Files/Microsoft/Web Platform Installer:/cygdrive/c/Program Files (x86)/Microsoft ASP.NET/ASP.NET Web Pages/v1.0:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files (x86)/Windows Kits/8.0/Windows Performance Toolkit:/usr/bin:/cygdrive/c/Users/385959/AppData/Local/Programs/Python/Python39/Scripts:/cygdrive/c/Users/385959/AppData/Local/Programs/Python/Python39:/cygdrive/c/Users/385959/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/385959/AppData/Local/GitHubDesktop/bin:/cygdrive/c/Users/385959/AppData/Local/Programs/Microsoft VS Code/bin)

Any help to resolve this is appreciated.

  • Sendmail is in /usr/sbin but that directory is not in your $PATH. Try using an full path when executing sendmail.
    – doneal24
    Nov 5 '21 at 18:18
  • Sendmail is working with the full path thanks
    – jakebake
    Nov 5 '21 at 18:41
  • @doneal24 : This does not explain why whereis could locate it. whereis searches PATH and MANPATH, and since the directories returned don't look like containing man-pages, I would conclude that they were found in the PATH. Nov 17 '21 at 10:00
  • 1
    @user1934428 whereis looks both in the $PATH and in standard system locations. That is why it found /usr/sbin/sendmail even though it was not in the path.
    – doneal24
    Nov 17 '21 at 13:42

Putting this in a answer so that it will not be deleted and will be of use to future questions.

Sendmail is in /usr/sbin but that directory is not in your PATH. Try using an full path when executing sendmail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.