Any Examples Sending Email Out?

I see that the example project for sending out emails from the web application has been removed. Is this because it no longer works? I have code in my program based on that example project and it is also not working. I am using the google smtp server to send out emails. Does anybody have a working example of how to send out emails from the web app using google’s smtp server??? Thanks for your help.

Google is pretty persnickety about smtp. You keep having to permit “less secure apps” every few months. You may want to use a different smtp service.

Ok. That makes sense. I will look for a new smtp service. In the meantime, this helps me get up and going again.

I permitted less secure apps again for my app and got a new password. Still doesnt work. Anybody have any ideas?

Maybe debug it against an alternate SMTP server like Tim said, then swap in the settings for Gmail. Have you looked at the ServerError event of the SMTPSecureSocket?

I do use smtp.gmail.com, port 587, to send emails. I have to enable less secure apps periodically, but haven’t had to get a new password.

You better enable 2FA and then create an app specific password for smtp.

2 Likes

This thread talks about turning on using an App password with google.

Send-email-with-attachment Post

I have not looked at the serverError event. I was trying to use a try catch statement to catch the errors but I couldn’t find what type of errors to catch. I guess I need to go back and read more on mail server. lol. I should have known about that event. I will try that out and see what I can find. Thank you.

Thanks Steve for the help. Ive tried doing everything in this post and didn’t have any luck. This may be because I have an administrative account set up for the company for google and my (child) google account my not have the proper permissions to do this. Everything seems to be right and I set up the password and I’m passing it into the mail server. But, it’s still not working.

To clarify you setup 2FA and created and app password.
You are using the app password assigned in your program to login?

Yes. I set up two factor authentication for my account. Then I added an app and grabbed the yellow password field. I assigned it to an app constant in my program and I am passing it into the mail server.

Can you post your authentication logic?

Think about transactional mail service via api. Like Mailjet. Thread title asks for examples for sending mail out. @Tim_Parnell has Mailjet code open source.

I’ve used it. Works great. I look forward to never using SMTP again if I can help it.

Oh and from memory Mailjet has the first one or two hundred emails free per month.

1 Like

I am looking for a new mail service. However, If I can get the google smtp servers to work then I can send out up to 10,000 emails a month for free. I don’t want to start paying for emails if I can help it. I definitely don’t want to stick with google for email because they have a mess going on with setting this up. So, if there are any other free services I would be more than happy to take a look.

I ended up using CURLEmailMBS because of issues we had with some clients using office365 for their email. It supports gmail and office365 very well. But still requires the 2FA and an app password with Gmail.

Change to using MBS for smtpsecuresocket

1 Like

Understood. Personally dont want a gmail address on anything I do. Period. Also the transactional services are trusted so incredibly high percentage go straight to inboxes.

I can send 200 transactional emails PER DAY with SendGrid. I’ve bought Selzy from AppSumo for 70$ which gives me 7500 contacts for mailing lists.

Hi

I’m using the following with no issues, just needed to generate the app password from gmail along with 2fa as sugested

MailSemaphore.Signal

Dim MailSocket As New SMTPSecureSocket
MailSocket.Address = "smtp.gmail.com"
MailSocket.Port = 465
MailSocket.ConnectionType = SMTPSecureSocket.TLSv1

MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
MailSocket.Secure = True
MailSocket.UserName = "username"
MailSocket.Password = "app password from gmail"

Were you able to get gmail working?