Rank: Newbie
Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 0
Location: GA
Thanks: 1 times
Recently ran into an issue where I sent 100+ emails to my gmail smtp relay. I got an error back saying "Too many login attempts, please try again later." Is it possible to login once and send all the of emails I need too? Thanks!
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,154
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
You can use Connect method and send multiple emails in one session like this:
https://www.emailarchite...k/?ct=smtpclient_connect Code:
using System;
using EASendMail;
void SendTwoMailsInOneConnection()
{
try
{
SmtpServer oServer = new SmtpServer("myserveraddress");
// SMTP user authentication
oServer.User = "myusername";
oServer.Password = "mypassword";
// Most mordern SMTP servers require SSL/TLS connection now.
// ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically.
oServer.ConnectType = SmtpConnectType.ConnectTryTLS;
SmtpClient oSmtp = new SmtpClient();
oSmtp.Connect(oServer);
SmtpMail oMail = new SmtpMail("TryIt");
oMail.From = new MailAddress("from@adminsystem.com");
oMail.To.Add(new MailAddress("to@adminsystem.com"));
oMail.Subject = "first test email";
oMail.TextBody = "test body";
oSmtp.SendMail(oMail);
Console.WriteLine("first sent");
oSmtp.Reset();
oMail.Reset();
oMail.From = new MailAddress("from@adminsystem.com");
oMail.To.Add(new MailAddress("another@adminsystem.com"));
oMail.Subject = "second test email";
oMail.TextBody = "another body";
oSmtp.SendMail(oMail);
Console.WriteLine("second sent");
oSmtp.Quit();
}
catch (Exception exp)
{
Console.WriteLine("Exception: {0}", exp.Message);
}
}
1 user thanked ivan for this useful post.
Rank: Newbie
Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 0
Location: GA
Thanks: 1 times
Fantastic. Thank you! I switched to SendGrid for a short time, but honestly, I like using your library better. Thanks again.
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.