Xamarin Android Send Email

So I'm making a personal app through android and I'm trying to figure out how to send emails. By send emails, i mean click a button and the credentials are already filled in and it just sends, no pop up email windows. I did something similar for my windows application and it works great:

 private void EmailSneder(string messageToSend) { enableTheForm = false; Hide(); WindowState = FormWindowState.Minimized; textBoxMessage.Text = nullString; try { SmtpClient client = new SmtpClient("smtp.gmail.com", 587); MailMessage message = new MailMessage(); message.From = new MailAddress("EMAIL FROM"); //Who it's from message.To.Add("EMAIL TO"); // The E-Mail that recieves the message message.Subject = "Replay from PC"; message.Body = messageToSend; client.UseDefaultCredentials = false; client.EnableSsl = true; client.Credentials = new System.Net.NetworkCredential("USERNAME", "PASSWORD"); client.Send(message); } catch { MessageBox.Show("Error !"); } } 

I've tried googling it and experimenting for the last few days but nothing has worked. Any help would be great!

by 17waldth via /r/csharp

Leave a Reply