smtpclient

SMTP dot stuffing - who does it and who removes it

只谈情不闲聊 提交于 2019-12-05 14:48:17
I have written an email client and have from time to time noticed that links in some received mails fail because of two dots in a URL where there should be one. By Investigating, I found that in all such cases the two dots are at the start of a line of quoted-printable HTML. On reading RFC 2821, I see this is probably happening because of dot-stuffing. My question basically is, who should do the dot-stuffing and who should remove it? If we take a simple sequence we have as follows: A ----> B ----> C ----> D where A is the sending client, B is the SMTP server to which A sends the mail, C is the

SmtpClient.Send randomly causes SmtpException 4.7.0 timeout waiting for client input

有些话、适合烂在心里 提交于 2019-12-05 14:36:28
I can't seem to find the cause for this problem. Sometimes I get SmtpException "4.7.0 timeout waiting for client input" being thrown on using the following c# code for .net-4.0 : using System; using System.Net.Mail; namespace SendMail { class Program { static void Main(string[] args) { for (int i = 0; i < 100; i++) { string html = "<h1>TEST</h1>"; using (MailMessage mail = new MailMessage("sender@domain.com", "receiver@domain.com")) { mail.Subject = "Test"; mail.IsBodyHtml = true; mail.Body = html; using (SmtpClient client = new SmtpClient("<internal ip address>")) { client

Troubleshooting “The server committed a protocol violation” when sending mail with SmtpClient

白昼怎懂夜的黑 提交于 2019-12-05 07:06:13
I want to send a mail message with the SmtpClient class. Here's the code I use: SmtpClient smtpClient = new SmtpClient("Host",25); NetworkCredential basicCredential = new NetworkCredential("UserName", "Password"); MailMessage message = new MailMessage(); MailAddress fromAddress = new MailAddress("me@domain.com"); smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = basicCredential; message.From = fromAddress; message.Subject = "test send"; message.IsBodyHtml = true; message.Body = "<h1>hello</h1>"; message.To.Add("mail@domain.com"); smtpClient.Send(message); But it always throws

“The function requested is not supported” exception when using SmtpClient in Azure role

你说的曾经没有我的故事 提交于 2019-12-05 06:41:09
I'm getting an exception when using SmtpClient in an Azure Web or Worker role. I created a console app to manually run on the role VMs via RDP to reproduce: using System; using System.Net; using System.Net.Mail; using System.Text; namespace ConsoleApplication1 { class Program { static void Main() { var mailClient = new SmtpClient("mail.redacted.com", 587); mailClient.EnableSsl = true; mailClient.DeliveryFormat = SmtpDeliveryFormat.International; mailClient.DeliveryMethod = SmtpDeliveryMethod.Network; mailClient.UseDefaultCredentials = false;//SET THIS FIRST OR IT WIPES OUT CREDENTIALS

SmtpClient.SendAsync Calls are Automatically Cancelled

扶醉桌前 提交于 2019-12-05 03:46:49
Whenever I call smtpClient.SendAsync(...) from within my ASP.NET MVC application, the asynchronous requests are automatically cancelled, even though SendAsyncCancel() is never called. Synchronous .Send(...) requests, on the other hand, go through just fine. My EmailService service wrapper handles sending asynchronous email with SmtpClient from within my ASP.NET MVC 3 application. A service instance is injected into each MVC controller by StructureMap, which wraps a new SmtpClient instance in a using (...) { } statement. Here is my EmailService.SendAsync wrapper method for SmtpClient : public

Outlook SMTPClient server error 5.3.4 5.2.0

旧时模样 提交于 2019-12-05 02:52:59
I have a MVC .NET web application that has been running stable for the most part of a year now. However today we received an error code and I'm having trouble finding how to resolve the issue. In the application I use SMTPClient to send emails out. For this we use a outlook email account. This was working fine until today. The error code that I get is this: Mailbox unavailable. The server response was: 5.3.4 554-554 5.2.0 STOREDRV.Deliver; delivery result banner Here is the code that I use in my application. var client = new SmtpClient { Host = WebConfigurationManager.AppSettings["EmailHost"],

SendMailAsync : An asynchronous module or handler completed while an asynchronous operation was still pending

不想你离开。 提交于 2019-12-05 01:53:15
While using SendMailAsync I am getting the following error: An asynchronous module or handler completed while an asynchronous operation was still pending My code : public static async Task SendEmail(MessageContent messageContent, string emailBody) { SmtpClient smtpClientNoSend = new SmtpClient(); await smtpClientNoSend.SendMailAsync(mailMessage); } Call From Controller: public async System.Threading.Tasks.Task<ActionResult> Register() { await SendEmail(); } private void SendEmail() { SMTPEmail.SendEmail(msg, output.ToString()); return null; } Your call hierarchy is broken. You shouldn't use

Using System.Net.Mail in ASP NET MVC 6 project

风流意气都作罢 提交于 2019-12-05 01:17:16
I have trouble creating a simple mock mail sender within an ASP NET 5 project. Here the method : public static Task SendMail(string Email, string Subject, string Body) { SmtpClient client = new SmtpClient(); client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; client.PickupDirectoryLocation = "C:\\TMP"; MailAddress from = new MailAddress("jane@contoso.com", "Jane " + (char)0xD8 + " Clayton", System.Text.Encoding.UTF8); MailAddress to = new MailAddress(Email); MailMessage message = new MailMessage(from, to); message.Body = Body; message.BodyEncoding = System.Text.Encoding.UTF8;

Sending out 20,000+ emails with asp.net

泪湿孤枕 提交于 2019-12-04 21:17:45
问题 I am writing an application that will need to send a massive amount of emails to our students who will be selected from our database (each email will be personalized to the extent that will include their name, course of study etc...so needs to be sent one at a time). I could do this looping over an SmtpClient, but I'm afraid that with the numbers I'm trying to send, I'll ultimately run into timeout issues or my thread being killed because of lack of machine resources. At this point I'm just

Sending 2000 emails [closed]

耗尽温柔 提交于 2019-12-04 21:10:03
Is it ok to instantiate a SMTP client once and send 2,000 emails on it synchronously? We are getting the following error, when instantiating a SMTP client for every message we send using the code also pasted at end of this post: System.Net.Mail.SmtpException: Service not available, closing transmission channel. The server response was: 4.4.1 Connection timed out I am suspecting that instantiating SMTP client for every message is causing this but not sure. Code is as below. List<MailMessage> messages = GetMailMessages(); foreach( MailMessags m in messages) { try { SmtpClient client = new