[Gambas-user] SMTP Client errors - Sending Email

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


On Wed, 2013-08-21 at 08:43 +0200, Rolf-Werner Eilert wrote:
> 
> Am 20.08.2013 20:00, schrieb Willy Raets:
> > 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
> >
> 
> Thank you for that tip, I've changed it accordingly. So "Test.pdf" just 
> gives a random name to be added to the data in the string, and it 
> doesn't need the path?

The 3rd argument in Add() is the name the attachment will get when
attached in the mail. You can use the same name as the original file you
would like to add (no need for the path) or make up a new name for the
attachement

> 
> > Over here in the Netherlands you have to use the smtp server of the
> > provider that is connecting you.
> 
> We can do the same here, but you could also use any other provider's 
> access like Yahoo, GMX etc. I tried them all, no success.

Have you tried with only server and port settings, no username, no
password, no 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.
> 
> Yes, this is pretty near to what I intend to do with my Gambas app.
> 
> >
> > 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.
> >
> 
> According to Benoit, Cairo works synchroneously, at least he is pretty 
> sure it does. But it turned out this wasn't my problem.
> 
> Except SMTP sending, it works great here too.
> 
> Thanks again for the advice!
> 
> Rolf
> 
> 
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and 
> AppDynamics. Performance Central is your source for news, insights, 
> analysis and resources for efficient Application Performance Management. 
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

-- 
Kind regards,

Willy (aka gbWilly)

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








More information about the User mailing list