나는 웹 메일 계정의 이메일을 모든 이메일 주소로 보냈습니다.PHP 메일과 함께 보낸 메일이 내 메일에 표시되지 않습니다. 보낸 편지함
메일이 성공적으로 전송되었지만,이 메일을 어떻게 보낼 수 있습니까? 웹 메일 계정은이라는 메일을 보냈습니다.
나는 codeigniter 이메일 보낸 기능을 사용합니다.
나는 웹 메일 계정의 이메일을 모든 이메일 주소로 보냈습니다.PHP 메일과 함께 보낸 메일이 내 메일에 표시되지 않습니다. 보낸 편지함
메일이 성공적으로 전송되었지만,이 메일을 어떻게 보낼 수 있습니까? 웹 메일 계정은이라는 메일을 보냈습니다.
나는 codeigniter 이메일 보낸 기능을 사용합니다.
질문에 코드를 포함해야합니다.
이것은 PHPMailer의 직업은 아니지만 관련이 있습니다. the end of the gmail example provided with PHPMailer을보십시오. 보낸 메시지를 IMAP 폴더에 업로드하는 섹션이 포함되어 있습니다.
...
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
//Section 2: IMAP
if (save_mail($mail)) {
echo "Message saved!";
}
}
//Section 2: IMAP
//IMAP commands requires the PHP IMAP Extension, found at: https://php.net/manual/en/imap.setup.php
//Function to call which uses the PHP imap_*() functions to save messages: https://php.net/manual/en/book.imap.php
//You can use imap_getmailboxes($imapStream, '/imap/ssl') to get a list of available folders or labels, this can
//be useful if you are trying to get this working on a non-Gmail IMAP server.
function save_mail($mail)
{
//You can change 'Sent Mail' to any other folder or tag
$path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail";
//Tell your server to open an IMAP connection using the same username and password as you used for SMTP
$imapStream = imap_open($path, $mail->Username, $mail->Password);
$result = imap_append($imapStream, $path, $mail->getSentMIMEMessage());
imap_close($imapStream);
return $result;
}
CodeIgniter는이 PHPMailer 래퍼를 사용하지만, 당신이 얻을 수 있어야합니다 : 기본 개념은 성공적인 send()
응답을받은 후, 메시지의 사본을 얻을하고 IMAP 사서함에 업로드 할 것입니다 어떻게 든 필요한 데이터에 액세스 할 수 있으며 IMAP 코드는 PHPMailer에만 국한되지 않습니다.
답장을 보내 주셔서 감사합니다. imap_append이 (가) 나를 위해 일했습니다. excelentlly – Sahak10
Gmail의 경우 smtp.gmail.com을 통해 보낸 메일은 자동으로 보낸 편지함에 사본이 저장됩니다. 이것은 비표준 동작입니다. – Max
@ user5677872 - 내 대답을 좋아하고 문제가 해결되면 정답으로 표시하십시오. – Synchro