Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Why is Outlook Exchange Account Sending only 5 messages?

$
0
0

Hello my friends:

I am sending messages using the below code in Console App in Visual Studio 2012. For some reason when I send from my exchange server account, I can send only 5 messages at once when I run the application. I have a total of 10 contact in a table and I want to email all of them when I run the App. But Only 5 gets the message.

However, if I send from a free outlook.com web account, then I am able to send all 10 messages at once. I am not sure if this is a server configuration issue.

Code Snippet:

publicstaticvoidSendMail(string recipientEmail,string subject,string body){
using (MailMessage mailMessage =newMailMessage()){try{
mailMessage.From=newMailAddress(ConfigurationManager.AppSettings["MailFrom"]);
mailMessage.Subject= subject;
mailMessage.Body= body;
mailMessage.IsBodyHtml=true;
mailMessage.To.Add(newMailAddress(recipientEmail));SmtpClient smtp =newSmtpClient();
smtp.Host=ConfigurationManager.AppSettings["MailHost"];
smtp.EnableSsl=Convert.ToBoolean(ConfigurationManager.AppSettings["MailEnableSsl"]);System.Net.NetworkCredentialNetworkCred=newSystem.Net.NetworkCredential();NetworkCred.UserName=ConfigurationManager.AppSettings["MailUserName"];NetworkCred.Password=ConfigurationManager.AppSettings["MailPassword"];
smtp.UseDefaultCredentials=true;
smtp.Credentials=NetworkCred;
smtp.Port=int.Parse(ConfigurationManager.AppSettings["MailPort"]);
smtp.Send(mailMessage);}catch(MailException ex){throw ex;}catch(Exception ex){thrownewMailException("Email sending failed", ex);}}}


In the App Config file:

<add key="MailHost" value="Mail.myMail.com"/><add key="MailEnableSsl" value="true"/><add key="MailFrom" value="myEmailAddress"/><add key="MailUserName" value="MyUserName"/><add key="MailPassword" value="MyPassword"/><add key="MailPort" value="587"/><add key="MailTemplatePath" value="X:\MyFolder\email.html"/><add key="MailSubject" value="MyEmail Subject"/>


I am not sure what is causing this issue.

Thanks for your help.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>