-2

Can i send email without giving password on the NetworkCredentials? here is my code.

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    MailMessage Myemail = new MailMessage();

    private void btnsendemail_Click(object sender, EventArgs e)
    {
        SmtpClient myGmailserver = new SmtpClient("smtp.gmail.com",587);

        myGmailserver.Credentials = new NetworkCredential("Email ID", "password");

        Myemail.From = new MailAddress("Email ID");

        Myemail.To.Add(tbTo.Text);

        Myemail.Subject = tbsubject.Text;

        Myemail.Body = tbmsg.Text;

        myGmailserver.EnableSsl = true;
        myGmailserver.Send(Myemail);
    }
}

on the line myGmailserver.Credentials = new NetworkCredential("Email ID", "Password"); it asks for a password for that specific email what if i want to send email to someone and not knowing the password of that email how can i do it? please answer

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

1 Answers1

0

Ok,I got my answer the password was for the credential not for the recipients..I got another thing to ask,I add the timer in my form and the timer is ticking.For example at "8:00pm" an email should be sent automatically to the manager sales for sale reporting.Someone help me with this please.