Re: system
Tim Even writes: > I've been using Chez/Petite Scheme's system command as a sort of > Scheme interface to Netpbm and other executables. Any information -- > more than what is in the documentation -- on a Guile equivalent? Guile has a `system' procedure as well. Note that its behavior does not seem to be one-to-one equivalent to that of Chez; you can refer to its documentation for details. Taylan
Re: system
Taylan Ulrich Bayirli/Kammer skribis: > Tim Even writes: > > > I've been using Chez/Petite Scheme's system command as a sort of > > Scheme interface to Netpbm and other executables. Any information -- > > more than what is in the documentation -- on a Guile equivalent? > > Guile has a `system' procedure as well. > > Note that its behavior does not seem to be one-to-one equivalent to that > of Chez; you can refer to its documentation for details. > > Taylan The POSIX Processes section. There are system and system*, and POSIX fork-and-exec primitives for the adventurous. A string search on system* in the one-page html version of the manual (my favorite version) should find it most easily.
guile - sending emails
How can i send emails from guile script? Is there any module for that purpose? I know that there is mailutils but can't figure out how to do that with it. Please, show me some examples. -- Konrad
Re: guile - sending emails
On Mon, 20 Oct 2014 22:17:47 +0200 Konrad Makowski wrote: > How can i send emails from guile script? Is there any module for that > purpose? I know that there is mailutils but can't figure out how to > do that with it. Please, show me some examples. I use mailx for that together with guile-lib's (os process) module, mainly because I know what they do, I have used them before and they work. Here is part of a daemon script I use to broadcast a change of ip address to a list of recipients for internal purposes. It should be self-explanatory: there are various things defined elsewhere in the script. (define (send-ip ip changed) (let ([preamble (if changed "Changed: " "Reminder: ")]) (log (string-append preamble "sending " ip " to " (reduce (lambda (cur prev) (string-append prev " " cur)) "" to-mail-addr))) (let* ([res (apply run-with-pipe "w" "mailx" "-s" "IP" "-r" from-mail-addr to-mail-addr)] [pid (car res)] [output (cdr res)]) (put-string output (string-append preamble ip "\n")) (close-port output) ;; closing the pipe causes mailx to unblock and send (let ([ret (status:exit-val (cdr (waitpid pid)))]) (when (or (not ret) (not (= ret 0))) (log "Error invoking mailx"))
Re: guile - sending emails
> On Monday, October 20, 2014 2:14 PM, Chris Vine > wrote: > > On Mon, 20 Oct 2014 22:17:47 +0200 > Konrad Makowski wrote: >> How can i send emails from guile script? Is there any module for that >> purpose? I know that there is mailutils but can't figure out how to >> do that with it. Please, show me some examples. I've never actually looked at GNU Mailutils before, so I didn't know it has a scheme interface. Sweet. Has anyone been using it? Just for fun, I added the missing options to guile-curl that would allow one to send an e-mail. If one checked out the very latest git at ... https://github.com/spk121/guile-curl ...one could do something like the following. But, that is a bit crap. A proper library would handle the bookkeeping of the many names, addresses, and dates appear multiple times in SMTP headers. Regards, Mike Gran --- (use-modules (curl)) (setlocale LC_ALL "") (define data-port (open-input-string (string-append "From: \"John Doe\" \r\n" "To: \"John Smith\" \r\n" "Subject: Test Message\r\n" "\r\n" "This is the body of my mesage.\r\n"))) (define handle (curl-easy-init)) (curl-easy-setopt handle 'url "smtps://smtp.mail.yahoo.com:465") (curl-easy-setopt handle 'verbose #t) (curl-easy-setopt handle 'use-ssl CURLUSESSL_ALL) (curl-easy-setopt handle 'username "j...@yahoo.com") (curl-easy-setopt handle 'password "x") (curl-easy-setopt handle 'mail-from "j...@yahoo.com") (curl-easy-setopt handle 'mail-rcpt '("jsm...@nobody.com")) (curl-easy-setopt handle 'readdata data-port) (curl-easy-perform handle)
Re: guile - sending emails
I don't know if there's any lib for sending mails, but I do have a similar module in Artanis: https://github.com/NalaGinrut/artanis/blob/wip-sql-mapping/artanis/sendmail.scm It's naive and simple since it's not a significant part for a web-framework at present, but maybe enough to inspire someone to write a completed standalone one. ;-) -Usage- (define sender (make-simple-mail-sender "a...@a.com" "b...@b.com" #:sender "/usr/sbin/sendmail")) (send-the-mail (sender "hello!" #:subject "test")) -end- It's a buggy module, so please don't ask me why, if you can't send out the mail...and please checkout your sendmail config first. The example above works for me anyway. Happy hacking! On Tue, Oct 21, 2014 at 4:17 AM, Konrad Makowski wrote: > How can i send emails from guile script? Is there any module for that > purpose? I know that there is mailutils but can't figure out how to do that > with it. Please, show me some examples. > > -- > Konrad > >