简体   繁体   中英

(php) Does mail() save the “sent mail”?

I use mail() in php to send mails.

I don't know much about mail() and I have to send mail without saving mails I sent.

In general mailing service such as gmail, there is "sent" page which displays the mails I sent. (after log in, you can access via here )

It means google saves the mails I sent in db. But does mail() save too?

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. Saving your E-Mails in a sent folder is something that an application (Google Mail, Thunderbird, Outlook) explicitely does for you.

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.

No, mail function just send a mail, nothing else. 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).

no , the php mail() function is only function which send email to receiver. It does not provide any kind of storing what is it send.

read documentation carefully

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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