andrewdavey / postal

Email sending for asp.net mvc using the view engine system to render emails.
http://aboutcode.net/postal
MIT License
536 stars 169 forks source link

enable sasl authentification #173

Open samirnext opened 6 years ago

samirnext commented 6 years ago

hi , i use postal to send mail from c# mvc application i need to use email with SASL authtification and the default configuration is not working for me

how i can fix this issue

thanks for advanced

phantomtypist commented 6 years ago

Hi @samirnext!

Can you help me out? Would you be able to provide some example code or even create a throw-away repo or a GitHub Gist with a sample app containing the pertinent code that isn't working? Don't include anything sensitive like credentials for your SMTP account. The gist is, do you have a reproduction case for me that I can use and go off of?

Also, would you be able to tell me what SMTP provider you are trying to authenticate against? (e.g. Google, Amazon SES, etc.)

phantomtypist commented 6 years ago

I'm just going to leave a little more information here for you to see if you covered your bases.

At my work all of the SmtpClient configuration is done in the web.config/app.config files. We don't actually hard-code anything in the code. If you have the correct authentication and SmtpClient configuration settings in your web.config/app.config file, then Postal should just work out of the box, especially with let's say Gmail and Sasl.

References:

So in the "network" element, you need to make sure:

If you haven't tried those things go ahead and play around with that and let me know if that fixes your issue or not. If I don't hear back from you by the end of February I'll consider the issue closed.

samirnext commented 6 years ago

Hi, when i use dotnet smtp (without postal ) it work by adding this lines :

            ServicePointManager.ServerCertificateValidationCallback = (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => true;
            SmtpConexiune.DeliveryMethod = SmtpDeliveryMethod.Network;
            mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            SecurityProtocolType oldSecurityProtocol = ServicePointManager.SecurityProtocol;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
            SmtpConexiune.Send(mail);
            ServicePointManager.SecurityProtocol = oldSecurityProtocol;

how i can enable the tls security protocole in tha app.config ?

thanks

samirnext commented 6 years ago

hi, i resolve this issue but adding this line before Send() methode ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; thanks

josephflyer917 commented 10 months ago

Hi there! It sounds like you need to configure SASL authentication for sending email in your C# MVC laser application using Postal. You might want to check your SMTP settings and credentials. Ensure they match your email provider's requirements. If you still face issues, consider providing more details for specific help. Good luck.

Fredricksonjustin39 commented 10 months ago

Sure, I'd be happy to help with enabling SASL authentication. Could you please provide more specific details about the system or platform you are referring to? This will allow me to provide you with accurate instructions movers.

Justinhandrickson123 commented 10 months ago

Enabling SASL authentication is a crucial step for enhancing security in various systems and applications. If you have any specific questions or need guidance on how to enable SASL authentication in a particular context Investement Visa, please provide more details, and I'd be happy to assist further.