Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using the code at Send email with smtp authentication using ASP.NET 3.5[^], I tested email delivery through our company's SMTP service. It works in general. But there is one defect. I send the email though my email account in the SMTP email server. After I send an email, my SMTP mailbox Sent Items does not have the email I sent. I did enter my email address, like that below:
e_mail.From = new MailAddress(txtFrom.Text);
Any hint? Thanks.
Posted
Updated 17-May-14 5:18am
v2

1 solution

Use the same id in From and NetworkCredentials. Also use Sender property same as From property.

I have tried it using gmail account and it works.
 
Share this answer
 
Comments
[no name] 2-Apr-14 7:37am    
I set Smtp_Server.UseDefaultCredentials = false;
which means neither userID nor password is needed for sending email. I also tested that even though I enter a fake email address (only need to be valid format), the emails can be delivered. The email can be CCed, but the Bcc-ed email is not received. Please tell me how to add code for the 'From' NetworkCredentials. Thanks.
Code Help 2014 2-Apr-14 7:40am    
This is already given in the example that you have used. Here is a line of code from the link given by you:

System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential("email", "password");
[no name] 2-Apr-14 7:48am    
I added this line already. However, in my tests, no matter whether userID and password are provided or not, and Smtp_Server.UseDefaultCredentials = true; the emails are always sent. Thanks anyway.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900