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 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

All works fine, but when a text file is attached the content of file is
showed under the .Body content. Sending the same file with Thunderbird, The
content of the message is both the same, except this, relative to
attachement:

Content-Type: text/plain; charset=UTF-8;
 name="ftp.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="ftp.txt"

The message that send the smtp client has:

Content-Type: text/plain; name="sirigamin.txt"
Content-Transfer-Encoding: quoted-printable
Content-Length: 13

abcdefghijklmn

Seems that Gambas smtpclient doesn't base64 encode the file attached if is
plain/text...
Is this a expected behavior?  Can it be changed or the encode forced?

Thanks in advance
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to