[Gambas-user] Sending E-Mail...
Ru Vuott
vuott at ...325...
Tue Mar 19 10:44:03 CET 2013
Hello Fabien,
well, I communicated to our friend in the italian Forum also your suggestion.
Thank you very much.
vuott
--- Mar 19/3/13, Fabien Bodard <gambas.fr at ...626...> ha scritto:
> Da: Fabien Bodard <gambas.fr at ...626...>
> Oggetto: Re: [Gambas-user] Sending E-Mail...
> A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
> Data: Martedì 19 marzo 2013, 08:35
> #!/usr/bin/env gbs3
>
>
> USE "gb.db", "gb.net.smtp"
>
> Private hcon As New Connection
> Private hTim as Timer
> Public Sub Main()
> Application.Daemon = True
> hTim = new timer as "Timer1"
> hTim.Delay = 60000
> hTim.Trigger()
> hTim.Start
> End
>
> Public sub Timer1_Timer()
> Dim hsmtp As Smtpclient
> Dim hResMails As Result
> Dim s As String
>
> 'Définir la connection
> hcon.type = "mysql"
> hCon.host = "localhost"
> hcon.login = "#######"
> hCon.password = "*******"
> hcon.name = "GF"
>
> hResMails = db.exec("SELECT * FROM emails")
>
> For Each hResMails
> hsmtp = New SmtpClient
> hsmtp.Host = "mail.toile-libre.org"
> hsmtp.User = "gf_info at ...2827..."
> hsmtp.Password = "*******"
> hsmtp.Port = 587
> hsmtp.From = hsmtp.User
>
> For Each s In Split(hResMails!to)
> hsmtp.To.Add(s)
> Next
> For Each s In Split(hResMails!cc)
> hsmtp.Cc.Add(s)
> Next
> For Each s In Split(hResMails!bcc)
> hsmtp.bcc.Add(s)
> Next
> hsmtp.Subject = iif(hResMails!sujet,
> hResMails!sujet, "nosubject")
> hsmtp.Add(hResMails!message, "text/plain")
> if hResMails!message_html Then
> hsmtp.Add(hResMails!message_html,
> "text/html")
> hsmtp.Send()
> Next
> If hResMails.count = 0 Then Return
> hResMails.MoveLast()
> db.Exec("DELETE FROM emails WHERE id<=&1",
> hResMails!id)
>
> Catch
> File.Save(User.Home &/ "mailerror.log",
> Format(Now(), GB.GeneralDate) &
> ": \n" & Error.Backtrace.Join("\n") & " " &
> Error.Text & " " & Error.Where
> & "\n")
>
>
> End
>
> This is the mail deamon of gambasforge, it work since more
> than one year
> without fail nor reboot. It control the db every 1 min. The
> page refresh is
> more quick :-)
>
> A good Script example too :-)
>
>
> 2013/3/18 Ru Vuott <vuott at ...325...>
>
> > Hello Willy,
> >
> > thanks a lot ! I communicated via Forum to our friend
> your gentle answer.
> >
> > I'll let you know a possible additional message.
> >
> > Bye
> > vuooott
> >
> >
> > --- Lun 18/3/13, Willy Raets <willy at ...2734...>
> ha scritto:
> >
> > > Da: Willy Raets <willy at ...2734...>
> > > Oggetto: Re: [Gambas-user] Sending E-Mail...
> > > A: gambas-user at lists.sourceforge.net
> > > Data: Lunedì 18 marzo 2013, 21:50
> > > On Mon, 2013-03-18 at 18:55 +0000, Ru
> > > Vuott wrote:
> > > > Hello,
> > > >
> > > > I would like to point out what a forum member
> of
> > > "Gambas-it.org" wrote about the problem of sending
> email:
> > > >
> > > > ********
> > > > These days I tried the component gb.net.smtp
> with poor
> > > results, then I started to study and I made a
> small class to
> > > send mail with a Telnet terminal.
> > > >
> > > > But I would like to know if the Socket of
> gambas could
> > > somehow replace Telnet to communicate with the
> SMTP server.
> > > >
> > > > 220 posta.hextra.it Service
> ready
> > > >
> > > > and then it seems to disconnect !!!
> > > >
> > > > Have you had similar experiences ?
> > > >
> > > > *********
> > > >
> > > > Well, as we can help our friend?
> > > >
> > > > Thanks
> > > >
> > > > vuott
> > > >
> > > What seems to be the problem as I have no trouble
> sending
> > > mail usingI commented out the encryption as I
> don't get it to work. But
> > that is
> > not a Gambas problem as my regular (non Gambas mail
> client) can't send
> > SSL or TSL either
> > > gb,net.smtp
> > >
> > > This is an example directly from one of my
> projects.
> > > Note that info is retrieved from setting on a
> mail
> > > preferences form
> > > where user can set the values and they are saved
> as
> > > settings.
> > >
> > > Nore: All settings are string values from settings
> file
> > > using
> > > gb.settings.
> > > Settings["mail/from"] = yourmail at ...3115...
> > > Settings["mail/smtp"] = smtp.yourprovider.org
> > > Settings["mail/port"] = 25
> > >
> > > DefaultMail is a Public String variable I use to
> provide my
> > > own mail
> > > address.
> > > I use this routine for error trapping and having
> error info
> > > send back to
> > > me automatically if Mail Preferences are set.
> > >
> > > It works like a charm..
> > >
> > > Private Sub SendMail(TextToSend As String, Subject
> As
> > > String)
> > >
> > > Dim hMail As New SmtpClient
> > > hMail.To.Add(DefaultMail)
> > > hMail.From =
> Settings["mail/from"]
> > > hMail.Host =
> Settings["mail/smtp"]
> > > hMail.Port =
> Settings["mail/port"]
> > > 'If Settings["mail/tsl"] = -1
> Then
> > > ' hMail.Encrypt = 2
> > > 'Else
> > > hMail.Encrypt = 0
> > > 'Endif
> > > hMail.Subject = Subject
> > > hMail.Add(TextToSend)
> > > hMail.Send
> > > MailSend = True
> > >
> > > End
> > >
> > > I commented out the encryption as I don't get it
> to work.
> > > But that is
> > > not a Gambas problem as my regular (non Gambas
> mail client)
> > > can't send
> > > SSL or TSL either.
> > >
> > > Hope this can help your friend
> > >
> > > --
> > > Kind regards,
> > >
> > > Willy (aka gbWilly)
> > >
> > > http://gambasshowcase.org/
> > > http://howtogambas.org
> > > http://gambos.org
> > >
> > >
> > >
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > Everyone hates slow websites. So do we.
> > > Make your web apps faster with AppDynamics
> > > Download AppDynamics Lite for free today:
> > > http://p.sf.net/sfu/appdyn_d2d_mar
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Everyone hates slow websites. So do we.
> > Make your web apps faster with AppDynamics
> > Download AppDynamics Lite for free today:
> > http://p.sf.net/sfu/appdyn_d2d_mar
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
> --
> Fabien Bodard
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> 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