I am creating simple email sending application. In my application when ever I send email I have to put my email address or password as from but I don't want to use password only want to put email.
So:
Can I send email without using password using C#/.net application?
This is my code:
try
{
// setup mail message
MailMessage message = new MailMessage();
message.From = new MailAddress(textBox1.Text);
message.To.Add(new MailAddress(textBox2.Text));
message.Subject = textBox3.Text;
message.Body = richTextBox1.Text;
// setup mail client
SmtpClient mailClient = new SmtpClient("smtp.gmail.com");
mailClient.Credentials = new NetworkCredential(textBox1.Text,"password");
// send message
mailClient.Send(message);
MessageBox.Show("Sent");
}
catch(Exception)
{
MessageBox.Show("Error");
}
Can i send Email without using password using c#/.net application ?
Yes, if you have access to an email gateway that doesn't require authentication you can simply do:
SmtpClient mailClient = new SmtpClient("your.emailgateway.com");
mailClient.Send(message);
Maybe your company or ISP can provide one for you?