[Gambas-user] gb.SMTP Errors

Willy Raets willy at ...2734...
Wed Aug 21 14:21:27 CEST 2013


On Tue, 2013-08-20 at 20:25 -0400, Marty McGlensey wrote:
> Thanks, Willy. The change from mime.Text to "text/Plain cured the Mime
> error. I still get the authentication error: error 535 - 5.7.8. I've tried
> to send emails to accounts located on the same server. No mail sent. Tried
> setting gb.smpt to the same parameters as my wife's account. Her account
> works with no encryption and port 25 in window Outlook but, fails with
> gb.smpt. Same error 535. See routine below.
> 
>  

Here is the code of a routine I use in one of my applications.

Some notes to make it understandable:
1. Some of the information used comes from a selection in a Combobox
(mail from), some TextBoxes (mail to, mail subject) and some TextAreas
(mail Add for both body and attachment)
2. The Bugreport.MakeErrorSendFile() in Catch is a routine somewhere
else handling my error reporting, so I know what goes wrong and where.
3. MailSend in a Public Boolean used elsewhere in the application to
give users an indication if mail send successfully or not.

-----------------------------------------
Private Sub SendMail()
  
  Dim hMail As New SmtpClient
  hMail.Port = 25
  hMail.Host = "smtp.xxxx.xxx"
  hMail.Bcc.Add("xxxx at ...3172...")
  hMail.From = cmbxFrom.Text
  hMail.To.Add(tbxTo.Text)
  hMail.Subject = tbxSubject.Text
  hMail.Add(txaBody.Text,, "")
  hMail.Add(txaAttachment.Text, "text/plain", "BijlageMailMinMax.txt")
  hMail.Send
  MailSend = True
  
  Catch
    MailSend = False
    BugReport.MakeErrorSendFile(Error.Code, Error.Text, Error.Where)
    Error.Clear
  
End
-----------------------------------------

As you see I only use port and host, no User or password, no encrypt.
Maybe the error occurs in the authentication part, don't know as I never
used authentication combined with smtp in any of my applications.

> 
> Dim t$ As String
> 
> > 15      Dim email As New SmtpClient
> 
> > 16
> 
> > 17      t$ = File.Load("/home/marty/Test.txt")
> 
> > 18
> 
> > 19      With email
> 
> > 20        .Add("Hello")
> 
> > 21        .Add(t$, Text/Plain, "Test.txt")
> 
> > 22        .To.Add("xxxxxx at ...3172...")
> 
> > 23        .From = "xxxxxx at ...3172..."
> 
> > 24        .Subject = "Linux Test"
> 
> > 25        .Encrypt = Net.None
> 
> > 26        .Port = 25
> 
> > 27        .Host = "smtp.xxxx.com"
> 
> > 28        .User = "xxxxxxx at ...3172..."
> 
> > 29        .Password = "password"
> 
> > 30        .Debug = True
> 
> > 31     End With
> 
> > 32
> 
> > 33      email.Send()
> 
> > 

-- 
Kind regards,

Willy (aka gbWilly)

http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org








More information about the User mailing list