Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

System.Net.Mail.SmtpException #734


User avatar
0
sampath created

Hi, I have tried to send emails by using MailTrap service from local host.But it gives below mentioned error.I have set all the parameters correctly.Could you tell me why ? Thanks.

Note : I have commented this line too.

IocManager.Register<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);

MailTrap : [https://mailtrap.io])

Exception :

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required

Code snippet :

public async Task SendEmailAsync(Email email)
        {
            var emailTemplate = new StringBuilder(_emailTemplateProvider.GetDefaultTemplate());
            emailTemplate.Replace("{EMAIL_TITLE}", L("CeTitle"));
            emailTemplate.Replace("{EMAIL_SUB_TITLE}", L("CeSubTitle"));

            var mailMessage = new StringBuilder();
            mailMessage.AppendLine("<b>" + L("CeHello") + "</b>" + "<br />");
            mailMessage.AppendLine("<br />");
            emailTemplate.Replace("{EMAIL_BODY}", mailMessage.ToString());

            await _emailSender.SendAsync(email.EmailAddress, email.Subject, emailTemplate.ToString());
        }

Settings :

Mailtrap settings :


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    You can try 465 port.

    ABP SMTP email sending code is fairly simple: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp/Net/Mail/Smtp/SmtpEmailSender.cs#L12">https://github.com/aspnetboilerplate/as ... der.cs#L12</a>

    If you really suspect that it can be a problem, you can directly create .NET's standard SmtpClient class and send email. If it sends, then ABP should also send. If not, problem should be related to your settings or SMTP server.

    Note: Your password is being seen in the screenshot!