Link to home
Start Free TrialLog in
Avatar of RayT
RayTFlag for United States of America

asked on

Sending email using SMTP

How do you send an email using SMTP, Visual Basic and Visual Studio 2019?  I can't get it to work!!!
Avatar of it_saige
it_saige
Flag of United States of America image

What are your implementation details?

-saige-
Sending is fairly straight forward. Normally you'll use an SMTP library for this, rather than writing your own SMTP code.

As it_saige mentioned, we'll have to see your code to provide assistance.
Aside: There's a big difference between sending email + having email delivery.

You can't just setup SMTP, send an email, imagine it will every arrive at a recipient.

For high deliverability email, you'll use a relay service like https://MailGun.com or setup your own sending infrastructure.

https://www.experts-exchange.com/questions/29158183/Backloading-emails-into-gmail.html covers a minimal checklist of how to get started, if you require building a high deliverability, SMTP infrastructure.

Likely best to start with https://MailGun.com, then move on to setting up your own infrastructure.
What have you tried? System.Net.Mail?

Your issues might come from your relay. You need to use one (Gmail, O365, ...). What are you using?

Have a look at https://www.emoreau.com/Entries/Articles/2007/09/Using-SystemNetMail.aspx
Hi Ray,

As other experts have suggested, without looking at your code it is next to impossible to guess what is the real culprit.
Also, just so you know, Microsoft's current recommendation is to use library like MailKit
https://github.com/jstedfast/MailKit
per, https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient?view=netframework-4.8

Currently, SmtpClient is supported only to provide platform compatibility and should be avoided, if possible.
https://github.com/dotnet/platform-compat/blob/master/docs/DE0005.md

Let me know if you need more information on the same.

Regards,
Chinmay.
Avatar of RayT

ASKER

Chinmay,

How do you use MailKit?  Is it free?
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RayT

ASKER

Thanks!  Microsoft move away from the email business some time ago (https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient?view=netframework-4.8) and it's been costly to find solutions.  I'm currently paying an annual fee for a solution and I was curious to find a free solution.
If you opt for using MailKit or any other MTA-esque code which sends email from IPs you own, you must still go through all the IP setup checklist items for every sending IP you use.

https://www.experts-exchange.com/questions/29158183/Backloading-emails-into-gmail.html

If you expect to have any level of deliverability.

Remember: Sending email is easy. Having email deliver is a monumentally complex task.
Hi Ray,

With advent of .Net Core, I think almost all products will have a free, open source, community driven (But Microsoft backed/overwatched) alternative.

Let me know if there are other similar challenges you are facing, I might be able to drop in some pointers.

Regards,
Chinmay.