smtpclient

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

点点圈 提交于 2019-12-06 19:50:18
问题 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

C# - Can't send mail in WIndows Azure via Gmail SMTP

天大地大妈咪最大 提交于 2019-12-06 17:55:35
问题 This is my Web.config: <system.net> <mailSettings> <smtp deliveryMethod="Network"> <network defaultCredentials="true" enableSsl="true" host="smtp.gmail.com" port="25" userName="xxxxxxx@gmail.com" password="xxxxxxxxxxx"/> </smtp> </mailSettings> </system.net> My method: public static void EmailVerification(string email, string nickname) { MailAddress from = new MailAddress("xxxxxxxxxxx", "xxxxxxxxxxxx"); MailAddress to = new MailAddress(email); MailMessage message = new MailMessage(from, to);

Sending 2000 emails [closed]

倖福魔咒の 提交于 2019-12-06 16:09:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago . 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

What ports does a 'System.Net.Mail.SmtpClient' need with 'SmtpClient.EnableSsl' set to true?

泄露秘密 提交于 2019-12-06 11:14:23
问题 As the title says, what ports does an 'System::Net::Mail::SmtpClient' need with 'SmtpClient::EnableSsl' set to true? The documentation on the EnableSsl property says the default port for an alternative connection method is 465 but doesn't mention what's used for the connection type it does support. Edit - If it makes a difference, I'm connecting to Gmail in this instance but generic answers would be welcome. 回答1: To send mail to Gmail using System::Net::Mail::SmtpClient and SSL, you must use

Alternative ways to send email without UI from ipad or iphone

旧巷老猫 提交于 2019-12-06 11:12:40
I see there are many ways to send email in the background (without UI) in iOS devices and without using MFMailComposeViewController class. Most popular examples are fill an online form and press submit button. Here are the most popular methods i see in stackoverflow.. (1) Using your own SMTP client. This approach is working for me but in my private network but not working in my company premises as in company network I am not allowed to use gmail (public emails) and don't have SMTP details of our company mail server. I am struck here in this approach. (2) Using CTCoreMessage & Three20 Framework

Send-MailMessage closes every 2nd connection when using attachments

戏子无情 提交于 2019-12-06 05:50:12
I am attempting to write a powershell script to send email with a few attachments to 30 people. The emails are personalized, so they must be sent individually. The script works just fine without attachments. However, when using attachments, every other instance of Send-MailMessage fails with: Send-MailMessage : Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. It does not seem to matter how long I wait/pause between sending messages. Even if I wait several minutes, the first instance will always succeed, the next will fail, the

How can i check smtp server without sending email? [duplicate]

不羁岁月 提交于 2019-12-06 04:59:05
This question already has answers here : Testing SMTP server is running via C# (5 answers) Closed 5 years ago . I had web application that users can set SMTP server information (server/host, SMTP Port, Username, Password, EmailAddress, usedSSL). i need when user set information validatre server without sending email and check Is smtp information valid or not? I found website that works perfect and check is SMTP server alive (but not authentication check).. http://mxtoolbox.com/diagnostic.aspx Edit 1: Tanx @Dieter DHoker help me to find Testing SMTP server is running via C# in comments... Is

How do i send an email when i already have it as a string?

蹲街弑〆低调 提交于 2019-12-05 21:17:09
Effectively I'm trying to send some template emails so that I can test a few components that handle reading from mailboxes. I could just load up outlook and send a couple of emails but I'm looking to find a solution that can read thousands of emails at a time so I need to bulk send these templates t test the reading code. When I say bulk send ... I have about 10 to 15 templates (varies) and I want to send about 1,000 copies of each to the given mailbox. Now here's th sticking point ... I could just fire up an instance of the SMTP client and declare a new MailMessage object then send that using

How to set the attatchment file name with chinese characters in C# SmtpClient programming?

时光怂恿深爱的人放手 提交于 2019-12-05 21:06:22
my code is as below: ContentType ct = new ContentType(); ct.MediaType = MediaTypeNames.Application.Octet; ct.Name = "这是一个很长的中文文件名希望能用它在附件名中.Doc"; Attachment attach = new Attachment(stream, ct); but the attachement received is not with the right chinese filename, and I found the ct.Name becames "=?utf-8?B?6L+Z5piv5LiA5Liq5b6I6ZW/55qE5Lit5paH5paH5Lu25ZCN5biM5pyb?=\r\n =?utf-8?B?6IO955So5a6D5Zyo6ZmE5Lu25ZCN5Lit?=" in the VS2010 debuger. plz advice, how do I use the chinese charaters in attachment file name? Harish Can you try: Attachment att = new Attachment(@"c:\path to file\somename.txt",

Email sending service in c# doesn't recover after server timeout

走远了吗. 提交于 2019-12-05 15:13:04
问题 I've been having this problem for months, and it's driving me nuts. I have a windows service written in C# (.NET 4.5) which basically sends emails, using an outlook account (I think it's an office365 service). I'm aware of the "order of credentials" problem, which isn't affecting me (many emails send correctly). The service starts correctly and begins sending emails. Sometimes when there's too many, I get a server error to wait, the service waits a few minutes and continues perfectly on its