[Gambas-user] SMTP error in Gambas 3.6.0 (rev#6552)
Willy Raets
willy at ...2734...
Wed Oct 15 13:48:54 CEST 2014
Hi,
I've been testing smpt on Gambas 3.6.0 (rev#6552).
I use the exact same settings as I do in my mail client Evolution (see
screenshot smtp-settings-evolution.png), but Gambas smtp fails with
error:
'Unable to send mail:Unable to connect to the SMTP server:EHLO command
failed' (see attached screenshot smtp-error.png)
The form shown on screenshot is part of a Gambas library that user can
use to set their mail settings so the library can use those settings to
send me error reports.
The info filled in in the textboxes is stored in Settings and used from
there in the code below. (see screenshot smtp-settings.png -> I placed
xxxx on real date for the screenshot, but real info was used for the
test)
This is the code for the Test button, that tests the connection, but
returns above error:
Public Sub btnTest_Click()
Dim hMail As New SmtpClient
Dim sMessage As String
Dim iL, iE As Integer
Dim bMailSend As Boolean
Inc Application.Busy
Settings.Save
$bIsChanged = False
Wait
hMail.To.Add(Settings["LibGb3DevAid/mailfrom"])
hMail.From = Settings["LibGb3DevAid/mailfrom"]
hMail.Host = Settings["LibGb3DevAid/smtp"]
hMail.Port = Settings["LibGb3DevAid/port"]
If Settings["LibGb3DevAid/authenticate"] = -1 Then
hMail.User = Settings["LibGb3DevAid/user"]
hMail.Password = Settings["LibGb3DevAid/password"]
Endif
If Not IsNull(Settings["LibGb3DevAid/encrypt"]) Then
hMail.Encrypt = Settings["LibGb3DevAid/encrypt"]
Else
hMail.Encrypt = 0
Endif
hMail.Subject = ("Test connection of your mail settings")
hMail.Add(Subst(("You have succesfuly send a mail using mail settings
in application &1."), Local.DefaultAppName))
hMail.Send
bMailSend = True
Finally
Dec Application.Busy
If bMailSend Then
sMessage = Subst(("Check you &1 mailbox to see if the test mail
has been send correctly."), Settings["LibGb3DevAid/mailfrom"])
Message.Info(sMessage)
Endif
Catch
bMailSend = False
If Len(Error.Text) > 70 Then
iL = Int(Len(Error.Text) / 2)
iE = InStr(Error.Text, " ", iL)
sMessage = Left(Error.Text, iE)
sMessage &= "\n" & Mid(Error.Text, iE + 1, Len(Error.Text) - iE)
sMessage &= ("\n\nConnection test failed!!")
Else
sMessage = Error.Text & ("\n\nConnection test failed!!")
Endif
Message.Info(sMessage)
Error.Clear
End
It is quite important to me that this works in Gambas 3.6, so I hope it
can be solved before final 3.6 release.
If needed to help solve the problem I can make a mail address at the
server for testing purposes.
--
Kind regards,
Willy (aka gbWilly)
http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smtp-error.png
Type: image/png
Size: 72576 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20141015/c7417060/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smtp-settings.png
Type: image/png
Size: 60928 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20141015/c7417060/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smtp-settings-evolution.png
Type: image/png
Size: 51180 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20141015/c7417060/attachment-0002.png>
More information about the User
mailing list