[Gambas-user] About SMTP component
T Lee Davidson
t.lee.davidson at ...626...
Wed Oct 22 21:40:03 CEST 2014
Jorge,
I took your code and modified it only enough to use a form to populate
the relevant data; all else remained the same.
Testing it showed that the attachment was indeed sent as
"Content-Transfer-Encoding: quoted-printable".
But, that does not appear to be a problem; at least with my Thunderbird.
The attachment was sent as a true attachment (showing the paperclip) and
not included in the message body.
Perhaps Base64 encoding is not required for plain text and, hence, the
reason Gambas does not bother with it.
--
Lee
__________
"Artificial Intelligence is no match for natural stupidity."
On 10/22/2014 06:49 AM, 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 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
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list