Sendemail command not found in cygwin

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:  [email protected]\ncc: [email protected]\n\nAttached is a zip folder containing the reports for the snapshots" | sendmail -t -f [email protected] -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.


Solution 1:

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.