Email data from form

Hi. I would like some direction on how to send an email to myself from fields in a desktop app without having the user open their email client to send the email. I tried working through the email example in Xojo but am not getting it to work. I made up a dummy gmail account for all the data to be sent from, instead of having the user enter their email client, server, username and password. On the form, I added a TCP Socket and changed the Super to SMTPSocket. Also, I have a textbox to enter the To address and a textarea for the email body. The pushbutton code is below. Is this possible to accomplish? Can you see where I might be going wrong? Are there any settings in gmail I need to change? I already updated the setting in gmail to allow SMTP and disallow POP

[code] dim mail as EmailMessage
MailSocket.Address = “smtp.gmail.com
MailSocket.Port = 25

MailSocket.Username = “xxxx@gmail.com
MailSocket.Password = “password”

mail = new EmailMessage
mail.fromAddress = “xxxx@gmail.com
mail.subject = “testing email”
mail.bodyPlainText = TextArea1.Text
mail.headers.appendHeader “X-Mailer”,“Example SMTP Demo”

mail.AddRecipient trim(TextField1.Text)

MailSocket.Messages.Append mail
MailSocket.SendMail[/code]

Gmail requires a TLS connection, so you’re going to have to use smtpsecuresocket. Also make sure your from & to addresses are different otherwise gmail will consider the message spam.

Thank you Wayne! That was the trick!!

thanks Wayne … i did not know that but i did have problem many months ago when i do that…

You are both welcome.

wayne… how did u find out that if u used the same email address for both from and to, gmail will think it is spam?? i didn’t notice it is consider as spam but the problem i got is i can’t send email from gmail if it is the same but ok if i change the email address to send from.

It was actually from the NUG. I’d send email but never see it in the inbox, I would get replies so obviously other people were seeing the messages.

Will this work for just sending an email to a group of people letting them know a task has been completed? I am really new to this and trying to figure this out.

Yes. You can add multiple recipients to the email before sending.

This even might be useful for me. Is it just a button to send the email within a App?