简体   繁体   English

(php)mail()是否保存“已发送邮件”?

[英](php) Does mail() save the “sent mail”?

I use mail() in php to send mails. 我在php中使用mail()发送邮件。

I don't know much about mail() and I have to send mail without saving mails I sent. 我对mail()不太了解,我必须发送邮件而不保存发送的邮件。

In general mailing service such as gmail, there is "sent" page which displays the mails I sent. 在一般的邮件服务(例如gmail)中,有一个“已发送”页面,其中显示了我发送的邮件。 (after log in, you can access via here ) (登录后,您可以通过此处访问)

It means google saves the mails I sent in db. 这意味着谷歌保存我在数据库中发送的邮件。 But does mail() save too? 但是mail()保存吗?

If it does, how can I do not save? 如果可以,我怎么不保存?

No, the php mail() function contacts directly the configured (possibly local) mail server which then forwards it to the destination. 不,php mail()函数直接与已配置的(可能是本地的)邮件服务器联系,然后将其转发到目的地。 Saving your E-Mails in a sent folder is something that an application (Google Mail, Thunderbird, Outlook) explicitely does for you. 应用程序(Google Mail,Thunderbird,Outlook)明确为您完成了将电子邮件保存在已发送文件夹中的任务。

If you want to save the mail in your google account, you probably need some kind of IMAP library to save the mail or you could send every mail in BCC to your account and create a filter to automatically move them to the sent folder. 如果要将邮件保存在Google帐户中,则可能需要某种IMAP库来保存邮件,或者可以将密件抄送中的每封邮件发送到您的帐户,并创建过滤器以自动将其移动到已发送的文件夹中。

No, mail function just send a mail, nothing else. 不, mail功能仅发送邮件,别无其他。 If you want to store your message somewhere, do it yourself. 如果您想将邮件存储在某个地方,请自己做。

$message = 'mail message';
$to = 'mail@example.com';
...
mail (...);
// here save your message to database

Or the second variant, you can log to IMAP server and then messages will be in your account (in PHP script has to be SMTP autentification of course). 或第二种变体,您可以登录到IMAP服务器,然后消息将在您的帐户中(当然,PHP脚本必须是SMTP强化)。

no , the php mail() function is only function which send email to receiver. ,php mail()函数仅是将电子邮件发送给收件人的函数。 It does not provide any kind of storing what is it send. 提供任何类型的存储是什么发出的。

read documentation carefully 仔细阅读文档

http://php.net/manual/en/function.mail.php http://php.net/manual/zh/function.mail.php

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

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