[Gambas-devel] How to: send email with Gambas ?

Benoit Minisini gambas at ...1...
Fri Sep 22 20:00:03 CEST 2006


On Thursday 21 September 2006 10:40, Tim Stefano wrote:
> Montelupo Fiorentino, Italy 21 Settembre/September 2006
>
> Hello to all,
>
> I'm a new developer in GAMBAS with Linux so for me everything is new.
> I try to found some example about send email with Gambas... but I'm not
> succed so I try to ask in the list
>
> I have installed ver 1.9.33 of gambas from kudla.org and I can work with
> serial line, browser and GUI interface (Qt).
>
> Now I try to use gb.net.smtp to send email in this way:
>
> smtpobj.From = "priastefano at ...255..."                                '  
>  I think the address who send the email smtpobj.To = "priastefano at ...506..."  
>                                              '    I think the address who
> receive the email smtpobj.Add ( "/home/Stefano/NameImage.jpg","image", "") 
>     '     Attacched file ? smtpobj.Send( )                                 
>                                            ' Send the message
>
> is correct ? (I think NO)

No, you must do:

smtpobj.Add(File.Load("/home/Stefano/NameImage.jpg"), "image/jpeg", 
"NameImage.jpg")

>
> when I try to set the address for
>         smtpobj.TO = "priastefano at ...506..."
> the interpreter say that:    smtpobj.TO is read only and I'm stop here.
>
> Can you help me ?
>
> Thank you very much in advance
>
> Distinti Saluti/Best Regards
>             Stefano Pria

SmtpClient.To, Bcc and Cc take a String array, not just a string, so that you 
can put as many addresses you want.

You must do: smtpobj.To.Add("priastefano at ...506...")

Regards,

-- 
Benoit Minisini





More information about the Devel mailing list