简体   繁体   English

将sendmail配置为仅将邮件发送到本地邮件地址

[英]Configure sendmail to send mail only to local mail address

I need to configure sendmail in order to test websites and app mail function locally; 我需要配置sendmail才能在本地测试网站和应用程序邮件功能;

I wish that if on production a mail() function sends a mail to user@hisdomain.com , the same code tested locally sends a mail to myfolder@localhost in order to check messages details, functionalities and so on. 我希望如果在生产时mail()函数将邮件发送到user@hisdomain.com ,则在本地测试的相同代码会将邮件发送到myfolder @ localhost以便检查消息的详细信息,功能等。

I'm on a LAMP machine. 我在LAMP机器上。

Is it possible? 可能吗?

You may configure sendmail to deliver all outgoing mail to local mailbox/alias. 您可以配置sendmail以将所有传出邮件传递到本地邮箱/别名。
It should catch all message to non local mailboxes. 它应该捕获所有邮件到非本地邮箱。

sendmail.mc file (used to generate sendmail.cf file): sendmail.mc文件(用于生成sendmail.cf文件):

define(`SMART_HOST`,`local:myfolder`)dnl

Restart/reload sendmail daemon after compiling new sendmail.cf file from sendmail.mc file. sendmail.mc文件编译新的sendmail.cf文件后,重新启动/重新加载sendmail守护程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM