go-gomail / gomail

The best way to send emails in Go.
MIT License
4.32k stars 572 forks source link

NewDialer() should support a hostname as an argument for SMTP helo #62

Open phocean opened 8 years ago

phocean commented 8 years ago

Hi,

As you state in the comments, e-mails are sent with "localhost" as the default hostname during the SMTP helo stage.

It causes some trouble as many anti-spam solution would badly penalize any e-mail sent by a machine presenting itself as "localhost".

Please update the function so that it takes the hostname as an argument.

func NewDialer(host string, port int, username, password string) *Dialer {
        return &Dialer{
                Host:     host,
                Port:     port,
                Username: username,
                Password: password,
                SSL:      port == 465,
                LocalName: "test.domain",
        }
}
jordan-wright commented 8 years ago

It would probably work to just use the configured hostname, right? I'm assuming on production systems the hostname is set appropriately.

phocean commented 8 years ago

Sure, but I am on a production system with a correctly configured hostname.

Moreover, I checked the code and, although I had never looked at go code before, I do not see it getting the hostname anywhere. I could be wrong, of course.

jordan-wright commented 8 years ago

Yes, I know, I was referring to using the hostname in the repo instead of "localhost".

On Jul 6, 2016, at 8:43 AM, phocean notifications@github.com wrote:

Sure, but I am on a production system with a correctly configured hostname.

Moreover, I checked the code and, although I had never looked at go code before, I do not see it getting the hostname anywhere.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.