Followed instructions from Documents on EMail

System: Linux Mint 19.3 Cinnamon

So I went to http://documentation.xojo.com/UserGuide:Email and followed the instructions and essentially copied the code. Made the appropriate changes to the code and… I get the errors listed below:

frmEventTracking.bvlBtnEmail.MouseDown, line 12
This item does not exist MailSocket.Address = “smtp.gmail.com

frmEventTracking.bvlBtnEmail.MouseDown, line 12
Type “Int32” has no member named “Address” MailSocket.Address = “smtp.gmail.com

frmEventTracking.bvlBtnEmail.MouseDown, line 13
This item does not exist MailSocket.Port = 465

And quite a few more. What… am I doing… wrong.

You have included an instance of this class in the project ?:

Mmm, no… I am not sure how to do that… yet. TO be honest I have never had to deal with classes for most of my applications (well… ones that I haven’t created that is…)

Insert Class:

image

image

Then Click the Super Pencil icon and choose the Superclass [1] and [2]. Then change name to match that in the documented code [3]

Then stick this code in the Action event of a button [4]:

11 posts were split to a new topic: Irrelevant Chatter from the Email Documentation Thread

How is your property MailSocket declared? You will need to have:

Var MailSocket as SMTPSecureSocket
MailSocket = new SMTPSecureSocket

in your code.

Xojo’s email functionality is extremely simple. Using MBS or the Chilkat plugin will save you a lot of work.

Using Gmail to send emails is a bad idea anyways. Except if you only send a very low number of emails.

And no, there shouldn’t be a declaration for the SMTPSecureSocket in the code. The socket needs to be in the window.

1 Like

Don’t see why. I create all my sockets in code. You kind of have to if you’re using threads, of which there will be a variable number.

Ouch. Don’t ever do that. The socket can go out of scope before the code finishes. You will never get errors. For threads where you make the socket in code you have to use AddHandlers to get the events.

I have my own thread class which includes all the necessary state. So no chance of a socket going out of scope and indeed I use AddHandler - that’s what it’s for.

Not sure offhand. You might take a look at the Email example projects for starters:

Examples/Communication/Internet/Email

Also check out the Lang Ref page:

https://documentation.xojo.com/api/networking/smtpsecuresocket.html

If you like to send emails, please check MBS Xojo CURL Plugin and the CURLEmailMBS class.
Our example projects show you how to build and send emails with attachments, multiple recipients, html & plain text.

2 Likes

To clarify my posting: the built-in classes are fine for a lot of Xojo developers.

But if you need more, you are welcome to try alternatives like our plugin classes to send/receive emails.

If you have questions about our plugin, please do not hesitate to contact us.

Otherwise just ignore this post.

1 Like

The ‘context’ was how to get the code the OP has working. Ergo the post is out of context.

Precedent set.

1 Like

The broader context is “How do I send emails from Xojo?” Seasoned developers know that there are many situations in which the built-in classes are insufficient. Therefore, alternative solutions are necessary. While Christian’s comments do not directly address the OP question, they are still germane to the broader issue.

3 Likes

Well said.

With that, could everyone please return to the topic at hand?

That’s your assumed broader context. Why assume when the known context is right in front of us and address what we do know, not what we don’t. For example, the broader context could well have been ‘I am learning Xojo and have picked a random documentation code snippet and cannot get it to work’ with a follow-up (i.e. still not assuming here) ‘I have not done much with classes’. This was met with an advert.

Don’t think anyone is disagreeing with you.

As before, your assumed broader issue.

The irony is that the question was answered but my follow-up (which rounded out the answer to the direct question being asked) was farmed out to the ‘irrelevant’ thread. So now (unlike earlier) this thread does not have an answer to the question (it did earlier) but does have an advert.

Just saying :slight_smile:

1 Like

Yes Kem. As per my post above, the solution to the question asked was farmed out to the irrelevant thread. If you would be so kind as to replace it here - the OP’s question will then be answered which is all I (and, according to the question) the OP wanted in the first place.

Steve

Back to the topic.

@John_McDonald, did you try the suggestion from @Paul_Lefebvreto play with the examples coming with Xojo? They show how to use it.

What is the status of the project?

Did you try SMTPSecureSocket class to benefit from TLS encryption, which is certainly required for gmail?

Did you put MailSocket as item on a window or add it as property to the window and instantiate it in code? Just having it as local variable won’t be enough.

I am at a complete loss here. Back to topic ? You mean the one that your spam derailed, right ? You have to be joking. Also why ask if John tried the examples ? He asked about making something specific work. He did not ask for samples and I find the timing of @Paul_Lefebvre’s post (intermixed, seemingly injected on the face of it) quizzing to say the least.

The problem @John_McDonald was facing was already solved but the thread was split and the last part of the answer was siphoned off to the thread starting with the ‘Irrelevant…’ title.

If this is what this forum is about then please ban me @Xojo. I am clearly wasted and indeed wasting my time here.

I have, in the last couple of days, lost an enormous amount of respect for what I (and I guarantee you a great deal of others) believed this place was about.

When I came here years ago, I immediately noticed what I believed to be a great deal of spam but bit my tongue. Well I am at the point that I do not need to do that anymore so I have commented. Any objective person sees that this was spam and shame on @Xojo for not having the fortitude to call it out as I did.

Enough said I believe. Happy to have stood up for what is correct, and deep down objective, rational and logical members know that what I have said is, indeed, correct but let’s not let what is right stand in the way of relationships and economics, as it appears from the outside, to be.

1 Like