[Gambas-user] About SMTP component

Jorge Carrión shordi at ...626...
Wed Oct 22 18:10:22 CEST 2014


Willy, thank you for your response.

With Mailtester the same situation occurs that with my function: If you
attach a text file, it is enconded as "cuoted printable" (what is the same
that "no enconded as all") and the text from inside the file is shown under
the message .Body...



2014-10-22 16:29 GMT+02:00 Willy Raets <willy at ...2734...>:

> On wo, 2014-10-22 at 12:49 +0200, Jorge Carrión wrote:
> > I've a problem with gambas 3.6 Smtpclient (with previous versions too).
> > perhaps I don't understand very well the SMTP protocol or I don't
> undestand
> > what some propertis of SmtpClient are, but If someone can help me I'll
> > appreciate it very much:
>
> I have added a source archive with application MailTester
>
> 1. It allows you to test mail with the settings entered in the form
> fields. Note that these are saved as setings (using gb.settings) and the
> password is stored in keyring (using gb.desktop) except for attachment
> path.
>
> 2. It also allows you to browse for an attachment and add it to the test
> mail.
>
> 3. It sends the mail to your from mail address and adds some body
> content to let you know it worked.
>
> 4. If using authentication it needs Gambas 3.6 at least (as
> authentication was still buggy pre 3.6)
>
>
> >
> > I use this function to send eMails:
> >
> > Public Sub enviarmail(aTo As String[], cSubject As String, cTexto As
> > String, cFrom As String, Optional aAttacheds As String[], Optional bcc As
> > String[])
> >
> >     Dim SmtpC As New SmtpClient
> >     Dim s, fich, mime, fname As String
> >
> >     SmtpC.debug = True
> >     SmtpC.host = mcomun.mailserver["host"]
> >     SmtpC.user = mcomun.mailserver["user"]
> >     SmtpC.password = mcomun.mailserver["password"]
> >     SmtpC.From = cFrom
> >     For Each s In aTo
> >         SmtpC.To.Add(s)
> >     Next
> >     SmtpC.Subject = cSubject
> >     SmtpC.Body = cTexto
> >     SmtpC.Alternative = False    ''Not sure about this is for
> >     If Not IsNull(aAttacheds) Then
> >         For Each fich In aAttacheds
> >             Exec ["file", "-bi", fich] To mime
> >             mime = Left(mime, InStr(mime, ";") - 1)
> >             fname = Right(fich, - RInStr(fich, "/"))
> >             SmtpC.Add(File.Load(fich), mime, fname)
> >         Next
> >     Endif
> >     If Not IsNull(bcc) Then
> >         For Each s In bcc
> >             SmtpC.bcc.Add(s)
> >         Next
> >     Endif
> >     SmtpC.Encrypt = Net.SSL
> >     SmtpC.send
> >
> > End
>
> You can test MailTester and if it works for you compare the code to
> yours.
>
> I have tested this with .png, .tar, .txt and .deb attachments and they
> are all nicely added.
>
> I also attached a screenshot of one of the test mails received.
>
>
> Hope this will help.
>
> --
> Kind regards,
>
> Willy (aka gbWilly)
>
> http://gambasshowcase.org/
> http://howtogambas.org
> http://gambos.org
>
>
>
>
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>



More information about the User mailing list