Drillster / drone-email

Drone plugin for sending email notifications
Apache License 2.0
46 stars 43 forks source link

Drone-Email uses wrong mail address #16

Closed jacksgt closed 7 years ago

jacksgt commented 7 years ago

Hi,

I'm trying to set up the drone-email to send notifications after builds, but I'm facing the issue that the plugin is using (or getting?) the wrong email address.

My .drone.yml (snippet):

  notify:
    image: drillster/drone-email
    host: smtp.example.com
    port: 587
    username: someone@example.com
    secrets:
      - EMAIL_PASSWORD
    from: drone@example.com
    when:
      status: [ changed, failure ]

However, I get the following error message:

time="2017-07-07T06:07:11Z" level=error msg="Could not send email to \"jh@\": gomail: could not send email 1: gomail: invalid address \"jh@\": mail: no angle-addr" 

The git comitter mail is very clearly jackdev at mailbox dot org, so I'm guessing drone-email is using my Gitea user account (jh) as the mail address:

Branch: ci-mail
Commit: da0b329e
Author: jh

Change mail host

Also, despite the error message, the plugins returns with exit code 0.

mjwwit commented 7 years ago

It appears Drone isn't populating the DRONE_COMMIT_AUTHOR_EMAIL field correctly. The plugin uses this field as the email-address. If it's populated with jh instead of an email-address, Drone is doing so, not the plugin. The Gitea remote for Drone is probably at fault here.

As for the plugin not exiting with code 1, that is an issue we'll need to address. I'll look into that asap.

jacksgt commented 7 years ago

You're right this is an issue with drone, see https://github.com/drone/drone/issues/2078

Thanks for your help!