Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
flashsplat  
#1 Posted : Monday, November 23, 2020 5:20:52 PM(UTC)
flashsplat

Rank: Newbie

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 0
United States
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!
ivan  
#2 Posted : Wednesday, November 25, 2020 3:58:00 AM(UTC)
ivan

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);
    }
}
thanks 1 user thanked ivan for this useful post.
flashsplat on 11/25/2020(UTC)
flashsplat  
#3 Posted : Wednesday, November 25, 2020 8:17:05 AM(UTC)
flashsplat

Rank: Newbie

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 0
United States
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.
Users browsing this topic
Guest
Forum Jump  
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.052 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.