+1 vote

hi,
i am using yahoo SMTP to send the mail. the mail send and receive to receiver but the mail not seen in yahoo send item.

by

1 Answer

0 votes

The SMTP/IMAP server behaviour in this matter is greatly provider dependand.

Some providers (e.g. Gmail) automatically put emails sent through their SMTP server in the Sent folder. Others don't.

In such case you need to upload the file manually using IMAP after sending.

The code that uploads sent email to the sent folder is quite simple:

// ...
var result = smtp.SendMessage(email);
// ...

if (result.Status == SendMessageStatus.Success)
{
    using (Imap imap = new Imap())
    {
        imap.Connect("imap.server.com");     // or ConnectSSL for SSL
        imap.UseBestLogin("user", "password");

        FolderInfo sent = new CommonFolders(imap.GetFolders()).Sent;
        imap.UploadMessage(sent, email);

        imap.Close();
    }
}

You can find entire listing here:
https://www.limilabs.com/blog/upload-email-to-sent-folder-after-sending

by (297k points)
...