[Gambas-user] PDF file sent by gb.net.smtp

Benoit Minisini gambas at ...1...
Fri Apr 18 15:37:20 CEST 2008


On vendredi 18 avril 2008, Leonardo Miliani wrote:
> Leonardo Miliani ha scritto:
> > Is it possible to send a PDF file using the gb.net.smtp component?
> > I made some tests and I was not able to get my file be sent by the
> > component. I only received an empty document...
> > Maybe the PDF Mime type isn't supported?
>
> I used this code:
> PUBLIC SUB SendMail_Click()
> DIM PostService AS NEW SmtpClient
>
>   PostService.To.Add(Trim(txtEmail.Text))
>   PostService.Subject = Trim(txtSubject.Text)
>   PostService.Add(txtText.Text)
>   PostService.Add(FileChooser1.SelectedPath, "application/pdf",
> "document.pdf")

The first argument is the data, not the file path. You must write:

PostService.Add(File.Load(FileChooser1.SelectedPath), "application/pdf", "document.pdf")

Regards,

-- 
Benoit Minisini




More information about the User mailing list