Sending Email - book example fails, no error msg

I’ve set up the email example according to the instructions in the Introduction to Programming with Xojo book (p. 278). I’m using the Gmail example, but the email fails to be sent. However, no errors/exceptions are raised. I have verified parameters against a similar VBA routine using Gmail, which continues to function without error. I find it strange that Xojo doesn’t raise any exception during compilation, or the error handling within the book’s example, or even outside of those features. Any suggestions /help or pointers would be appreciated!
Thank you… Scott

The project for the email example is included in the Introduction to Programming download (XojoProjects/Chapter 11/MailSender). I just tried it now by putting my gmail username and password in the code and it was able to send just fine. Perhaps compare the included example with yours to make sure they are set up similarly?

I don’t have the code of the book at the moment. You have the correct port? Are the SSL/TLS settings correct? And really absolutely nothing happens?

I think I recall having to change a setting in gmail in order to send through their smtp server. But that memory is a little fuzzy.

yes in your gmail account, you have to authorize third party apps to use the smtp and pop (or imap) server)
otherwise nothing happens.

If sending through Gmail works for the VBA code I’d assume that the Gmail settings aren’t the problem. The SSL/TLS settings are a good candidate for some checking.

Is it possible to get a log what the SMPT socket is doing? I find that very helpful when working with the Chilkat plugin.

This is the link to the last version of the book “IntroductionToProgrammingWithXojo-PDF.zip” that includes the examples:
http://www.xojo.com/learn/index.php

if you have an old version (without examples)… you better download this one.

You have all been incredibly helpful! I can’t thank you enough. You gave me a lot to work with and I’ve (you’ve) solved the problem. Here is what I found. I trust it may be helpful to other Xojo newbies :slight_smile: – although I still have a minor open question (#6 below).

  1. First, I typed in the whole app example again – just to make sure no typos were causing my problem.

  2. I added some more informative messaging (vs. the MsgBox statements suggested in the manual). I added a TextArea and appended text rather than displaying MsgBoxes in order to see the progression and retain the info. I then added error checking in the Error event on the TCPSocket. In the original SendMail app in the manual, there is no error checking in the Error event. This revealed that I was getting error 120 (using my work gmail address) and error 300 (using my home gmail address), although these error events were hidden in my first attempts to use this function.

  3. I downloaded the newest version of the book. I thought my 2014 version seemed a bit dated, but I had not seen the newer version until provided with the link from Emile. Thank you!

  4. The new book had one line of code different from the 2014 version. I changed:
    MailSocket.ConnectionType = SMTPSecureSocket.SSLv3
    to:
    MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS

  5. I updated my home e-mail address in Google settings to “allow less secure apps” to use that e-mail address. Now, messages sent using both the work and home e-mail addresses function well.

  6. Now the only issue I’m experiencing is error 120 AFTER e-mails have been successfully sent. From what I’ve seen in the forum after a Google search, there may be no way to eliminate this error. I believe it’s just signaling the fact that Google is dropping my connection, although why this would be flagged as an error is a mystery to me.

THANK YOU

Happy to be of some help.

[quote=306454:@R. Scott Poppele]6) Now the only issue I’m experiencing is error 120 AFTER e-mails have been successfully sent. From what I’ve seen in the forum after a Google search, there may be no way to eliminate this error. I believe it’s just signaling the fact that Google is dropping my connection, although why this would be flagged as an error is a mystery to me.
[/quote]
This is what it is. Not all “error” messages are actually errors :).

Did you find now the other conversation about IntroductionToProgrammingWithXojo-PDF.zip ?

Yes, I did. Thank you!