namsral / multipass

Better authentication for HTTP
BSD 3-Clause "New" or "Revised" License
73 stars 4 forks source link

Add support for SMTP clients (MSA) #11

Closed JuliCodes closed 7 years ago

JuliCodes commented 7 years ago

Hello,

i want to use multipass in conjunction with caddy.

But i prefer to send the mails with nullmailer (a sendmail alternative). Cause on my servers it's already configured to send the mails via a real smtp server.

Is there a possibility to configure multipass for this?

Greetings

namsral commented 7 years ago

Not yet, but this sounds like a good addition.

Currently Multipass supports MTA's using the gomail package. With the same package MSA's like nullmailer and sendmail can be supported with the Message.WriteTo method from the same package.

m := gomail.NewMessage()
cmd := exec.Command("/usr/sbin/sendmail", "-t")
cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
w, err := cmd.StdinPipe()
if err != nil {
    return
}
err = cmd.Start()
if err != nil {
    return
}
m.WriteTo(w)
w.Close()
cmd.Wait()
}

Thinking out loud for the configuration syntax:

multipass {
    ...
    sendmail /usr/sbin/sendmail -t
    mail_from "Multipass <no-reply@dallas>"
}
JuliCodes commented 7 years ago

Hey,

thanks for the fast response.

I think it would be easier to put the smtpcmd argument in "_ as it should be easier to parse.

But all in all i would really appreciate this functionality.

Secondly it could help you with the issue #8 :D

Greetings

namsral commented 7 years ago

The new SMTP client feature can also be helpful for testing mail message output.

To dump login URL requests in your home directory; create a new shell script, make it executable and add it to your configuration:

#!/usr/bin/env bash
set -e
cat <&0 > $HOME/$(date +%s).eml