> On Monday, October 20, 2014 2:14 PM, Chris Vine <ch...@cvine.freeserve.co.uk> 
> wrote:

> > On Mon, 20 Oct 2014 22:17:47 +0200
> Konrad Makowski <poc...@konradmakowski.pl> 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\" <j...@yahoo.com>\r\n"
      "To: \"John Smith\" <jsm...@nobody.com>\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 "xxxxx")
(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)

Reply via email to