Email Sender Problem!!

Hi Calvin, if you want to email your project to jason@xojo.com, I will take a look at it.

ok i did Dim it, but now I’m getting this error.

I send the project Jason,

Dim MailSocket As NEW SMTPSocket //add the NEW keyword

You need to make sure that you create an instance, not just create a location in memory for the object, that’s why you have the nil object exception.

+Jason King, by doing what you said it gives me no errors, but no email comes.

I’ve never used the email classes so unfortunately I can’t help with that, I was just pointing out the error causing the exception. Also I would recommend that you change your email password since you accidentally posted a screen shot with your password…

Yes of course… but thanks anyway

I found with gmail that I had to add the following setting or gmail often rejected authentication.

MailSocket.SMTPConnectionMode=1    'ModeSSLTLS

+Stephen Koger, Doesn’t seem to work

+Stephen Koger, so i just add MailSocket.SMTPConnectionMode=1 'ModeSSLTLS to my coding???

Yes in your setup the socket section

Well there is two, the top part, or the bottom.

Where you set the address, port, and username section

OK

doesn’t work, Stephen can you PLEASE send me a project which i can edit on my own (a premade one)
that would be a huge help.

if you can, send it at calvinleonhardt@gmail.com

Example program sent to your email

THANKS SO MUCH Stephen UR THE BEST !
IT WORKED GREAT!

It would be very good for you to understand where you had the problem. This is key to understand how Xojo works. Yes, I know it’s hard to change paradigms. And it’s even worse to ask concrete questions when you are starting.

Just saying…

I would attach the example here if I could. Here is my Action event for the Port 587 example.

[code] If Trim(txtUsername.Text) ="" Then
Msgbox (“Username cannot be Blank”)
Exit
End If
If Trim(txtPassword.Text) ="" Then
Msgbox (“Password cannot be Blank”)
Exit
End If
If Trim(txtRecipient.Text) ="" Then
Msgbox (“Recipient cannot be Blank”)
Exit
End If

ProgressWheel1.Visible=True
// Correct for Using Port 587
smtp.Address = “smtp.gmail.com
smtp.Secure = False
smtp.Port = 587
smtp.ConnectionType = 1
smtp.Username = txtUsername.Text
smtp.Password = txtPassword.Text

Dim mail As New EmailMessage
mail.FromAddress = txtUsername.Text
mail.AddRecipient(txtRecipient.Text)
mail.Subject = “Test Email thru Gmail Port 587”
mail.BodyPlainText = “Test Email thru Gmail Port 587”

smtp.Messages.Append(mail)
smtp.SendMail()[/code]

Here is the the Action Event for the Port 465 Example

[code] If Trim(txtUsername.Text) ="" Then
Msgbox (“Username cannot be Blank”)
Exit
End If
If Trim(txtPassword.Text) ="" Then
Msgbox (“Password cannot be Blank”)
Exit
End If
If Trim(txtRecipient.Text) ="" Then
Msgbox (“Recipient cannot be Blank”)
Exit
End If

ProgressWheel1.Visible=True
// Correct for Using Port 465
smtp.Address = “smtp.gmail.com
smtp.Secure = True
smtp.Port = 465
smtp.ConnectionType = 1
smtp.Username = txtUsername.Text
smtp.Password = txtPassword.Text

Dim mail As New EmailMessage
mail.FromAddress = txtUsername.Text
mail.AddRecipient(txtRecipient.Text)
mail.Subject = “Test Email thru Gmail Port 465”
mail.BodyPlainText = “Test Email thru Gmail Port 465”

smtp.Messages.Append(mail)
smtp.SendMail()[/code]

Screen shot showing SMTP the SMTPSecureSocket placed on my main Window.