[Gambas-user] SMTP Client errors - Sending Email

Willy Raets willy at ...2734...
Tue Aug 20 20:00:39 CEST 2013


On Tue, 2013-08-20 at 16:52 +0200, Rolf-Werner Eilert wrote:
> 
> Am 20.08.2013 15:52, schrieb Marty:
> > God Morning All,
> >
> > I'm using gb.smpt to send email from a Gambas routine. The routine is:
> >
> > 12 Public Sub btnSend_Click()
> > 13
> > 14  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$, Mime.Default, "Test.txt")
> > 22        .To.Add("xxxxxx at ...3172...")
> > 23        .From = "xxxxxx at ...3172..."
> > 24        .Subject = "Linux Test"
> > 25        .Encrypt = Net.SSL
> > 26        .Port = 465
> > 27        .Host = "smtp.xxxx.com"
> > 28        .User = "xxxxxxx at ...3172..."
> > 29        .Password = "password"
> > 30        .Debug = True
> > 31     End With
> > 32
> > 33      email.Send()
> >
> > End
> >
> > Sensitive data removed. There are multiple errors:
> >
> > 1. If I include the line to add an attachment -"Cannot find Mime subtype
> > in line 33"
> >
> > 2.If I use Net.SSL with port 465  "Error 535 Authentication failed"
> >       My account should use SSL and port 465. That's the way it is set up
> > on Windows.
> >       Debug output:
> > <- 220 relay01.dlls.pa.xxxxxxx.net ESMTP Postfix
> >
> > -> ehlo marty-xxxxxxxxxxxxxxxxxxxx
> >
> > <- 250-relay01.dlls.pa.xxxxx.net
> > 250-PIPELINING
> > 250-SIZE 36350634
> > 250-ETRN
> > 250-AUTH LOGIN PLAIN
> > 250-AUTH=LOGIN PLAIN
> > 250-ENHANCEDSTATUSCODES
> > 250-8BITMIME
> > 250 DSN
> >
> > -> auth plain AG1tY2cyOTQ0MEBmcm9udGllci5jb20AOTA2NlBvDQo=
> >
> > <- 535 5.7.8 Error: authentication failed: authentication failure
> >
> > -> quit
> >
> > No matter what I try the message is not sent. The docs say that V 3.4
> > supports encryption.
> > Can you  tell me where I'm going wrong? I'm running Ubuntu 12.04. Is it
> > possible that SSL is not installed? How can I check it? Then how to
> > install it?
> >
> > Thanks for your patience and help!
> >
> > Marty
> >
> 
> Hi Marty,
> 
> Not a spontaneous help, but as you will see in this list, I have had the 
> same or a similar problem with it during the last weeks. At least I can 
> say that I got no error with the Mime. thing, but I had a pdf to attach 
> and used Mime.Binary (no idea if that was correct, but there were no 
> complaints).

That is because in the .add you need to use a string for mime type.
Mime.binary will return an integer value.

@ Marty
For text file write .Add(t$, "text/plain","Test.txt")
Assuming that t$ is a File.Load of a text file

@ Rolf
For pfd file write .Add(t$, "application/pdf","Test.pdf")
Assuming that t$ is a File.Load of a pdf file

> 
> I tried with different providers and their different settings. With SSL, 
> I got no message at all, just ->quit. With TLS I got the same kind of 
> errors and found no way to solve them. That provider uses STARTTLS, 
> maybe it's not been fully implemented yet.
> 
> Eventually I used an external tool for sending the mails.

Over here in the Netherlands you have to use the smtp server of the
provider that is connecting you.
So at home I have one, going to my girlfriend I need to change my mail
client settings to her providers smtp server. At work I need to change
my mail client settings to that providers smtp server.

Hence all you need here is the smtp DNS name or IP, no username nor
password of the provider that is connecting you at that location.
So I can't help you with the SSl or TSL.

I can only say that I built a Gambas application at work that uses both
gb.smpt and gb.cairo (for pdf making). It sends information on extra
worked hours of personel to the accountants in a mail containing a
general text in the body and custom signature and an attached pdf
containing the information on extra hours for personel.

gb.cairo makes the pdf, next gb.smtp sends it all. I put a Wait 0.1 in
between to make sure pdf is complete before sending all.
Works like a charm.


-- 
Kind regards,

Willy (aka gbWilly)

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








More information about the User mailing list