I used to send emails with my app using my gmail login data but for a few days now it is not making the connections and I am no longer able to send emails via my app.
I never tried using it… they threatened too turn on 2 step authentication at work (which would have killed an important app of mine) so I looked into it a little bit… But they never turned it on so i never actually tried it.
Sendgrid has 200/day and 12.000/month free. Mandrill also has a free plan. Setting up Sendgrid takes about 5 minutes. There should be code around for using Mandrill in Xojo (search the forum).
Sending mails is quite simple. Add a secure SMTP socket to the window and then in a button or similar add some code:
[code]// set up the socket
Socket1.Secure = True
Socket1.ConnectionType = SMTPSecureSocket.TLSv1
Socket1.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
socket1.address = “smtp.sendgrid.net”
socket1.port = 465
socket1.username = app.GetMore
socket1.Password = app.GetSocket
if socket1.Username = “” or Socket1.Password = “” then
globals.theErrorLog.DialogErrorProceed kErrorUserNameMissing
Return
end if
// populate the email message to company
dim MailToCompany as new emailMessage
MailToCompany.fromAddress = TFName.Text + " <"+ TFEmailAddress.Text.Trim + “>”
MailToCompany.subject = “Error Report”
// add recipients
dim CompanyEmail as String = app.GetOther
if CompanyEmail <> “” then
MailToCompany.AddRecipient CompanyEmail
else
globals.theErrorLog.DialogErrorProceed Replace(kErrorEmailMissing, “<>”, Globals.Company)
Return
end if
'show that mail is being sent
LMailBeingSent.Text = kMailSend
ProgressWheel1.Visible = true
me.Enabled = False
PBCancel.Enabled = True
// send the emails
socket1.messages.append MailToCompany
socket1.sendMail[/code]
I’ve been trying it out without success.
I have a few questions…
SendgridMailSocket.username = is this the username that I created with Sendgrid
SendgridMailSocket.Password = is this the password that I created with Sendgrid
Is Sendgrid forwarding my emails via my Google account?
I had created an app password and 2-Step Verification with Google should I cancel them?
[quote=275171:@Lennox Jacob]Is Sendgrid forwarding my emails via my Google account?
I had created an app password and 2-Step Verification with Google should I cancel them?[/quote]
Your google e-mail has nothing to do with using another mail service, that’s kind of the point
I’ve been using a modified version of your code above, this is what I have…
// set up the socket
SendgridMailSocket.Secure = True
SendgridMailSocket.ConnectionType = SMTPSecureSocket.TLSv1
SendgridMailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
SendgridMailSocket.address = “smtp.sendgrid.net”
SendgridMailSocket.port = 465
SendgridMailSocket.username = “MySendgridUsername” //app.GetMore
SendgridMailSocket.Password = “MySendgridPassword” //app.GetSocket
'if SendgridMailSocket.Username = “” or SendgridMailSocket.Password = “” then
'globals.theErrorLog.DialogErrorProceed kErrorUserNameMissing
'Return
'end if
// populate the email message to company
dim MailToCompany as new emailMessage
MailToCompany.fromAddress = SendersEmailAddressTF.Text.Trim
MailToCompany.subject = EmailSubjectTF.Text
'show that mail is being sent
StatusText.Text = “Sending” //kMailSend // LMailBeingSent.Text = kMailSend
ProgressWheel1.Visible = true
me.Enabled = False
// send the emails
SendgridMailSocket.messages.append MailToCompany
SendgridMailSocket.sendMail
I did not see where the recipient address should be.