[Gambas-user] A smtpClient question
Jorge Carrión
shordi at ...626...
Sun Jun 1 11:10:41 CEST 2014
No answers? It's important for me... but perhaps too silly question.
I suppouse i'll have to compress all attachments in all mails.
That no solve the problem... just go around it.
Regards
2014-05-31 11:47 GMT+02:00 Jorge Carrión <shordi at ...626...>:
> I've a Sub to send email.
>
> If I send a no-attachment mail all is OK.
> If I send a non-text attached file, All is Ok.
> But If I send a mail with a text file attached then the mail sended
> contains the text that I send AND the text inside the attached file as
> body... AND the text file attached too.
>
> My function is this:
>
> Public Sub send_mail(aTo As String[], cSubject As String, cBody As String,
> cFrom As String, Optional aAtach As String[], Optional abcc As String[])
>
> Dim enviador As New SmtpClient
> Dim s, fich, mime, fname As String
>
> enviador.debug = True
> enviador.host = mcomun.mailserver["host"]
> enviador.user = mcomun.mailserver["user"]
> enviador.password = mcomun.mailserver["password"]
> enviador.Alternative = False
> enviador.From = cFrom
> For Each s In aTo
> enviador.To.Add(s)
> Next
> enviador.Subject = cSubject
> enviador.Body = cBody
> If Not IsNull(aAtach) Then
> For Each fich In aAtach
> Exec ["file", "-bi", fich] To mime
> mime = Left(mime, InStr(mime, ";") - 1)
> fname = Right(fich, - RInStr(fich, "/"))
> enviador.Add(File.Load(fich), mime, fname)
> Next
> Endif
> If Not IsNull(abcc) Then
> For Each s In abcc
> enviador.bcc.Add(s)
> Next
> Endif
>
> enviador.send
>
> End
>
> I suppose the smtpClient does something wrong when it detects thas is a
> multi mime-part mail... or I'm doing something wrong.
>
> Any help or suggestions?
>
> Regards
>
More information about the User
mailing list