guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile - sending emails


From: Mike Gran
Subject: Re: guile - sending emails
Date: Mon, 20 Oct 2014 23:13:21 +0000 (UTC)

> On Monday, October 20, 2014 2:14 PM, Chris Vine <address@hidden> wrote:

> > On Mon, 20 Oct 2014 22:17:47 +0200
> Konrad Makowski <address@hidden> 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\" <address@hidden>\r\n"
      "To: \"John Smith\" <address@hidden>\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 "address@hidden")
(curl-easy-setopt handle 'password "xxxxx")
(curl-easy-setopt handle 'mail-from "address@hidden")
(curl-easy-setopt handle 'mail-rcpt '("address@hidden"))
(curl-easy-setopt handle 'readdata data-port)
(curl-easy-perform handle)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]