因此,我尝试在 cygwin 中使用 sendmail,因为在服务器上我无法使用其他选项(如 mutt),因为它们不受支持。我在 cygwin 设置期间下载了 sendmail 包,但当我尝试运行我的代码时,它显示未找到 sendmail 命令。
这是我尝试在 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"
我尝试通过谷歌搜索来找出问题所在,但却无计可施。当我运行“whereis sendmail”时,我得到了以下信息:
sendmail: /usr/sbin/sendmail /usr/lib/sendmail /usr/libexec/sendmail.exe /usr/share/sendmail /cygdrive/c/Windows/system32/sendmail.dll
当我运行“which sendmail”时,我得到了这个:
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)
任何能解决此问题的帮助都将不胜感激。
答案1
将其放在答案中以便它不会被删除并且对将来的问题有用。
Sendmail 已存在,/usr/sbin
但该目录不在您的 中PATH
。执行 sendmail 时请尝试使用完整路径。