[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Success! (was Re: [bug-mailutils] More info; mailers?)
From: |
chris |
Subject: |
Success! (was Re: [bug-mailutils] More info; mailers?) |
Date: |
Fri, 20 Aug 2004 04:45:16 -1000 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) |
(Ooops, sorry about the empty post!)
Yesss! It works! I think the part I was missing is:
> (mu-register-format "smtp")
I guess maybe this is always required before (mu-message-send)? Even
for "sendmail"? It doesn't seem to be mentioned in the info, or did I
miss it?
The script you sent is really useful - it also cleared up a couple of
minor questions I had.
This is very, very helpful - sending messages was something I really
needed.
Good work, Sergey! Thanks!
Sergey Poznyakoff <address@hidden> writes:
> Hi Chris,
>
> I have tested mailutils with mod_guile. It works just as
> expected, except for a minor bug in the library[1]. Attached
> is a sample script I have used. It reads and displays
> contents of the given mailbox and then sends a simple message
> using smtp: mailer. Please, test if it works for you. You will
> have to modify variables my-mailbox and mu-mailer as well as 'From'
> and 'To' addresses (lines 54-55).
>
> Regards,
> Sergey
>
> [1] You have to always give second argument to mu-message-send
> (see line 63).
>
> (define my-mailbox "/var/spool/mail/gray")
> (set! %load-path (cons "/usr/share/mailutils" %load-path))
> (use-modules (mailutils))
>
> (display "<html><head><title>A Sample Scheme Page</title><head>
> <body>
> <h1>Hello from Guile!</h1>
> If you see this you successfully installed mod_guile.")
> (display "<br>You have also installed ")
> (display mu-package-string)
> (let ((mbox (mu-mailbox-open my-mailbox "r")))
> (display "<br>Opening mailbox <code>")
> (display my-mailbox)
> (display "</code>: ")
> (cond
> (mbox
> (let ((count (mu-mailbox-messages-count mbox)))
> (display count)
> (display " message(s)")
> (display "<h2>Mailbox listing:</h2>")
> (do ((n 1 (1+ n)))
> ((> n count) #f)
> (let ((msg (mu-mailbox-get-message mbox n)))
> (display "<h3>Message ")
> (display n)
> (display "</h3><p><pre>")
> (for-each
> (lambda (x)
> (display x)(display ": ")
> (display (mu-message-get-header msg x))
> (display "<br>"))
> '("From" "To" "Subject" "Date"))
> (display "<p>")
> (let ((port (mu-message-get-port msg "r")))
> (do ((line (read-line port) (read-line port)))
> ((eof-object? line) #f)
> (display line)
> (newline))
> (close-input-port port))
> (display "</pre>")))))
> (else
> (display "FAILED"))))
> (newline)
>
> ;; Now let's try to send something
> (mu-register-format "smtp")
> (set! mu-mailer "smtp://mirddin.farlep.net")
>
> (display "<h2>Sending message using ")
> (display mu-mailer)
> (display "</h3>")
>
> (let ((mesg (mu-message-create)))
> (mu-message-set-header mesg "From" "address@hidden")
> (mu-message-set-header mesg "To" "address@hidden")
> (mu-message-set-header mesg "Subject" "Notification")
> (let ((port (mu-message-get-port mesg "w")))
> (display "This message has been sent using Apache/mod_guile/GNU mailutils"
> port)
> (newline port)
> (close-output-port port))
> (display "Result <code>")
> (display (mu-message-send mesg))
> (display "</code>"))
>
> (display "
> </body>
> </html>")
>
--
There are 10 kinds of people in the world. Those who understand
binary, and those who don't.
-- Unknown
Re: [bug-mailutils] More info; mailers?, Sergey Poznyakoff, 2004/08/20
Re: [bug-mailutils] More info; mailers?, Sergey Poznyakoff, 2004/08/20