MailAddress mailFrom = new MailAddress("parris797877@yahoo.com"); MailAddress mailTo = new MailAddress("pevus55@gmail.com");
@Override protected boolean isValidRecipient(SMTPSession session, MailAddress recipient) { AccountStatus status = validator.getAccountStatus(recipient.toString()); session.getLogger().debug("Validated account (" + recipient + ") status is " + status); return status.equals(AccountStatus.ACTIVE) ? true : false; }
Mailbox mailbox = new Mailbox(recipient.toString()); String logMsg = new StringBuilder(" ").append(mailbox.getId()) .append(" DID").append(deliveryId).toString();
using System; using System.Net; using System.Net.Mail; using SendGridMail; using SendGridMail.Transport; SendGrid mail = SendGrid.GetInstance(); mail.From = new MailAddress("you@youremail.com"); mail.AddTo("test@sendgrid.com"); mail.Subject = "Sending with SendGrid is Fun"; mail.Text = "and easy to do anywhere, even with C#"; var credentials = new NetworkCredential(api_user, api_key); var transportWeb = new Web(credentials); transportWeb.Deliver(mail);
response = new SMTPResponse(SMTPRetCode.MAILBOX_PERM_UNAVAILABLE, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.ADDRESS_MAILBOX) + " Unknown user " + address.toString()); break; case OVER_QUOTA:
SmtpClient client = new SmtpClient(); MailMessage msg = new MailMessage(); MailAddress to = new MailAddress("client email address"); MailAddress from = new MailAddress("Your Email Address"); msg.IsBodyHtml = true; msg.Subject = "Mail Title"; msg.To.Add(to); msg.Body = "Your message"; msg.From = from; client.Send(msg);
Email newMail = new Email(); newMail.From = new MailAddress("someone@somewhere.com", "Your Name"); newMail.Password = "your outgoing mail password"); newMail.To = new MailAddress("someone@somewhere.com", "Recipient Name"); newMail.Subject = "Your Subject"; newMail.Body = "Your email body"; newMail.Host = smtp.example.com; newMail.Port = 123; //add the attachments (example) foreach (string fileLocation in AttachmentsList) { newMail.attachmentsList.Add(new Attachment(fileLocation)); } newMail.send();
MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("me@mydomain.com"); mail.To.Add("u@urdomain.com"); mail.Subject = filename; mail.Body = "Report"; Attachment attachment = new Attachment(filename); mail.Attachments.Add(attachment); SmtpServer.Port = 25; SmtpServer.Credentials = new System.Net.NetworkCredential("me", "password"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail);
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add("receiveremailaddress@xxx.com"); message.Subject = "This is the Subject line"; message.From = new MailAddress("youremailaddress@xxx.it", "Name to Display"); message.Body = "This is the message body"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost"); smtp.Credentials = new NetworkCredential("youremailaddress@xxx.it", "yourpassword"); smtp.Send(message);
MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("mail.yoursite.com"); mail.From = new MailAddress("testing@yoursite.com"); mail.To.Add("youremail@address.com"); mail.Subject = "New Email"; mail.Body = "add text here from controls"; SmtpServer.Port = 25; SmtpServer.Credentials = new System.Net.NetworkCredential("testing@yoursite.com", "passhere"); SmtpServer.EnableSsl = false; SmtpServer.Send(mail); MessageBox.Show("All Done");
using System.Net.Mail; protected void Button1_Click(object sender, EventArgs e) { MailMessage mail = new MailMessage(); mail.To.Add("Email ID where email is to be send"); mail.To.Add("Another Email ID where you wanna send same email"); mail.From = new MailAddress("YourGmailID@gmail.com"); mail.Subject = "Email using Gmail"; string Body = "Hi, this mail is to test sending mail"+ "using Gmail in ASP.NET"; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address smtp.Credentials = new System.Net.NetworkCredential ("YourUserName@gmail.com","YourGmailPassword"); //Or your Smtp Email ID and Password smtp.EnableSsl = true; smtp.Send(mail); }
MailMessage mm = new MailMessage(); mm.From = new MailAddress("xx"); mm.To.Add("xx"); mm.Subject = "Ant Subject"; mm.Body = "Body Cha MEssag here "; SmtpClient ss = new SmtpClient(); ss.Host="smtp.gmail.com"; ss.Port = 587; ss.EnableSsl = true; ss.Credentials = new System.Net.NetworkCredential("xx", "xx"); try { ss.Send(mm); Label1.Text = "Message Sent"; Label1.ForeColor = System.Drawing.Color.Green; } catch (SmtpException ex) { Label1.Text = "Message Not Sent : \n\n " + ex.Message; Label1.ForeColor = System.Drawing.Color.Red; }
try { MailMessage mail=new MailMessage(); SmtpClient SmtpServer=new SmtpClient("smtp.gmail.com"); mail.From=new MailAddress("from address here"); mail.To.Add("to adress here"); mail.Subject = "Message Subject"; mail.Body = "Message Body"; SmtpServer.Port = 587; SmtpServer.Credentials=new System.Net.NetworkCredential("username","password"); SmtpServer.EnableSsl=true; ServicePointManager.ServerCertificateValidationCallback=delegate(object sender, X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; }; SmtpServer.Send(mail); Toast.MakeText(Application.Context, "Mail Send Sucessufully", ToastLength.Short).Show(); } catch(Exception ex) { Toast.MakeText(Application.Context,ex.ToString(),ToastLength.Long); }
mail.From = new MailAddress(""); mail.Body = message; mail.To.Add(email);
mail.From = new MailAddress("me@mycompany.com"); mail.To.Add("you@yourcompany.com");
message.From = new MailAddress("someone@domain.com"); message.To.Add(new MailAddress("someoneElse@domain.com")); message.Subject = "Subject";