简体   繁体   English

我的php脚本向哪个用户发送电子邮件?

[英]Which user are my php scripts sending email as?

I have set up a postfix mailserver, and now I can send emails connecting to the smtp server through 'localhost', port 25. 我已经设置了一个后缀邮件服务器,现在我可以通过“ localhost”(端口25)发送连接到smtp服务器的电子邮件。

But I don't know how to check as which user the mail has been sent. 但是我不知道如何检查已发送邮件的用户。 I can send without authenticating myself, though it's not an open relay: it seems to work only for localhost. 我可以不进行身份验证就发送邮件,尽管它不是开放中继:它似乎仅适用于本地主机。

I would like to be forced to authenticate, or at least know which user is sending the mail, so I can set a quota for him, and a permitted 'from' (right now I can pick any of the available domains as the sender, when sending through a php script) 我想被迫进行身份验证,或者至少知道哪个用户正在发送邮件,因此我可以为他设置配额和允许的“发件人”(现在我可以选择任何可用域作为发件人,通过php脚本发送时)

I couldn't find anything other than the mail 'from' and 'to' in /var/log/maillog. 除了/ var / log / maillog中的邮件“发件人”和“发件人”以外,我什么都找不到。

Any ideas? 有任何想法吗?

You're question(s) is very confused. 您的问题很困惑。

I'll assume you are talking about what happens when you use the 'mail' command; 我假设您正在谈论使用“ mail”命令时会发生什么。 on a Unix system this just runs a program defined in the php.ini file - there are libs which allow you to send a mail by creating a network connection to a MTA - in which case the uid is not available directly to the MTA - and is the scenarion in which most admins would configure authentication. 在Unix系统上,它仅运行php.ini文件中定义的程序-有一些libs允许您通过与MTA建立网络连接来发送邮件-在这种情况下,uid无法直接用于MTA-并且是大多数管理员在其中配置身份验证的方案。

The uid of the sender will be the uid as whom PHP runs as. 发送者的uid将是运行PHP的uid。

Whether or not the MTA requires authentication has little to do with the uid invoking mail. MTA是否需要身份验证与调用邮件的uid无关。

In this scenario, the sender of the email will be the FROM address of the email. 在这种情况下,电子邮件的发件人将是电子邮件的“发件人”地址。

I would like to be forced to authenticate 我想被强制认证

Then use a socket based mailer such as phpmailer() and configure your MTA to require authentication. 然后使用基于套接字的邮件程序,例如phpmailer(),并将您的MTA配置为要求身份验证。

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

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