Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Jul 17, 2018 4:25 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: SMTPSocket and authenticated emails - Dim vs Object
PostPosted: Wed Jul 06, 2011 2:44 am 
Offline

Joined: Tue Mar 22, 2011 4:46 am
Posts: 28
Hi,

In my application I have a method that sends emails using SMTPSocket object (I drag into my application an object, and then select its Super property as SMTPSocket).
When I send non authenticated emails the method works just fine.
But when I try to send authenticated emails, I get the error "535 5.7.3 Authentication unsuccesfull".

Then I tried to do the same but declaring locally in the method a variable of type SMTPSocket (Dim socket1 As new SmtpSocket)
The rest of the method code remains the same.

This time the method sends succesfully all the authenticated emails.

Can anyone tell me what I'm I missing here?

Thanks in advance!!!

rb 2011 r2 on Windows 7


Top
 Profile  
Reply with quote  
 Post subject: Re: SMTPSocket and authenticated emails - Dim vs Object
PostPosted: Wed Jul 06, 2011 11:22 am 
Offline

Joined: Wed Mar 19, 2008 6:27 pm
Posts: 53
This is what I use to connect to Gmail. clsMailer is set to a super of SMTPSecureSocket.

Protected Sub sendEmail(recipient As String, subject As String, body As String)
// Setup mail socket
Dim mailer As New clsMailer

mailer.Secure = TRUE
mailer.ConnectionType = 2
mailer.Address = obMailHost
mailer.Port = 465

mailer.Username = obMailer
mailer.Password = obMailerP

// Prepare email message
Dim mailMessage As EmailMessage
mailMessage = New EmailMessage
mailMessage.AddRecipient(recipient)
Dim AddressFrom As String = "donotreply@youremail.com"
mailMessage.FromAddress = AddressFrom

mailMessage.Headers.AppendHeader "Return-path", AddressFrom
mailMessage.Headers.AppendHeader "Reply-To", AddressFrom
mailMessage.Headers.AppendHeader "X-Mailer", "Your Choice of Name"
mailMessage.Headers.AppendHeader "X-Accept-Language", "en"
mailMessage.Headers.AppendHeader "Content-Type", "text/plain; charset=us-ascii"
mailMessage.Headers.AppendHeader "Content-Transfer-Encoding", "7bit"

//mailMessage.Subject = "Test Email"
mailMessage.Subject = subject
//mailMessage.BodyPlainText = "This is a test email. "
mailMessage.BodyPlainText = body

mailer.Messages.Append mailMessage
mailer.SendMail


End Sub


Top
 Profile  
Reply with quote  
 Post subject: Re: SMTPSocket and authenticated emails - Dim vs Object
PostPosted: Thu Jul 07, 2011 3:33 am 
Offline

Joined: Tue Mar 22, 2011 4:46 am
Posts: 28
Thanks for your reply merft
I used SMTPSecureSocket and it worked!!!!!

I don't know what is the problem with SMTPSocket but since I have something that works I'm ok with this.

Thanks again for your help!!!!

rb 2011 r2 on Windows 7


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group