f5a7199254
Even if .drone.yml does not specify username and password, gomail.NewPlainDialer is still populated with them - albeit empty - which means they are still being sent to SMTP server. In case of Google's smtp-relay.gmail.com this will result in an error, even if CI's server IP address is added to exclusion list allowing it to skip auth entirely. This commit constructs gomail.Dialer without username and password if there was no username found in .drone.yml. * Constructs gomail.Dialer without username when no username in .drone.yml * Replaces gomail.NewPlainDialer with gomail.NewDialer |
||
---|---|---|
.drone.sec | ||
.drone.yml | ||
.gitignore | ||
Dockerfile | ||
DOCS.md | ||
LICENSE | ||
logo.svg | ||
main.go | ||
MAINTAINERS | ||
Makefile | ||
README.md | ||
sender.go | ||
template.go | ||
types.go |
drone-email
Drone plugin to send build status notifications via Email. For the usage information and a listing of the available options please take a look at the docs.
Binary
Build the binary using make
:
make deps build
Example
./drone-email <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"owner": "drone",
"name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
},
"build": {
"number": 22,
"status": "success",
"started_at": 1421029603,
"finished_at": 1421029813,
"message": "Update the Readme",
"author": "johnsmith",
"author_email": "john.smith@gmail.com",
"event": "push",
"branch": "master",
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c",
"ref": "refs/heads/master"
},
"workspace": {
"root": "/drone/src",
"path": "/drone/src/github.com/drone/drone"
},
"vargs": {
"from": "noreply@foo.com",
"host": "smtp.mailgun.org",
"port": 587,
"username": "",
"password": "",
"recipients": [
"octocat@github.com"
]
}
}
EOF
Docker
Build the container using make
:
make deps docker
Example
docker run -i plugins/drone-email <<EOF
{
"repo": {
"clone_url": "git://github.com/drone/drone",
"owner": "drone",
"name": "drone",
"full_name": "drone/drone"
},
"system": {
"link_url": "https://beta.drone.io"
},
"build": {
"number": 22,
"status": "success",
"started_at": 1421029603,
"finished_at": 1421029813,
"message": "Update the Readme",
"author": "johnsmith",
"author_email": "john.smith@gmail.com"
"event": "push",
"branch": "master",
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c",
"ref": "refs/heads/master"
},
"workspace": {
"root": "/drone/src",
"path": "/drone/src/github.com/drone/drone"
},
"vargs": {
"from": "noreply@foo.com",
"host": "smtp.mailgun.org",
"port": 587,
"username": "",
"password": "",
"recipients": [
"octocat@github.com"
]
}
}
EOF