Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ..mailbox unavailable server..... server response 5.7.3 Requested action aborted; user not authenticated.
- private void gmailTogmail(object sender, EventArgs e)
- {
- var mail = new MailMessage();
- var c = new MailAddressCollection { txtto.Text.Trim() };
- mail.From = new MailAddress(txtfrom.Text.ToLower().Trim());
- // mail.To.Add((c[0].Address));
- mail.To.Add(txtto.Text.ToLower());
- mail.Subject = "for hilk";
- mail.Body = "some heeeeeee";
- mail.IsBodyHtml = true;
- var smtp = new SmtpClient
- {
- Host = "smtp.gmail.com",
- Port = 587,
- Credentials = new NetworkCredential(txtfrom.Text.Trim(), txtpass.Text.Trim()),
- EnableSsl = true
- };
- smtp.Send(mail);
- MessageBox.Show("ok");
- }
- private void gmailToHotmail(object sender, EventArgs e)
- {
- SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
- var mail = new MailMessage();
- mail.From = new MailAddress(txtfrom.Text.Trim());
- mail.To.Add(txtto.Text.Trim());
- mail.Subject = "Your Sub";
- mail.IsBodyHtml = true;
- SmtpServer.Port = 587;
- SmtpServer.Timeout = 5000;
- SmtpServer.UseDefaultCredentials = false;
- SmtpServer.Credentials = new System.Net.NetworkCredential(txtfrom.Text.Trim(),txtpass.Text.Trim());
- SmtpServer.EnableSsl = true;
- SmtpServer.Send(mail);
- MessageBox.Show("ok");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement