[Gambas-user] smtp-client doesn't return

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Aug 1 00:25:36 CEST 2013



Am 31.07.2013 20:44, schrieb Willy Raets:
> On Wed, 2013-07-31 at 00:24 +0200, Rolf-Werner Eilert wrote:
>> Ok, maybe I got this completely wrong, so here's my first trial with
>> gb.net.smtp:
>>
>> Public Sub Main()
>>
>> Dim email As New SmtpClient
>>
>>     With email
>>       .Add("Is this the mailtext?")
>>       .To.Add("mymainemail at ...3165...")
>>       .From = "sender at ...3166..."
>>       .Subject = "Just a test"
>>       .Port = 25
>>       .Host = "smtp.provider.de"
>>       .User = "username"
>>       .Password = "password"
>>     End With
>>
>>     email.Send
>>
>> End
>>
>>
>> Everything is accepted, but email.Send never returns, i. e. the program
>> never stops and I've never got an email.
>>
>> Does .Add really add the message text, or is it for attachments only?
>> Where would I have to add the message body text then?
>>
>> The plan is to automatically send an email like from an ordinary mail
>> client (Thunderbird) via my smtp provider to the receiver. There should
>> be a mail text and a pdf attached.
>>
>> Regards
>>
>> Rolf
>
> email.Add("This is the body of the mail",,"")
> email.Add("This is attached as text file", "text/plain", "File.txt")
>
> First line should give you the body and the second line should produce
> you an attachment named File.txt with content "This is attached as text
> file".
>
> Don't know about attaching pdf, haven't been there but I am curious too.
>
> email.Send should send the mail. Don't know why it doesn't.
>
> Do you need the username and password for smtp at your provider? Else
> just skip it as it is send in plain text and easy to trap with a network
> sniffer.
>
>

Meanwhile I got it running - at least there is no more error message. 
Before I had some data wrong, there was an error message after some 
waiting. Now I used the ssl connection and added Encrypt = net.ssl

It seems to run now, but the testmail has never appeared.

Regards
Rolf




More information about the User mailing list