Skip to content

SMTPAuthCustom / SetSMTPAuth doesn't appear to be effectual #428

@james-d-elliott

Description

@james-d-elliott

Description

When using a custom auth implementation it's completely ignored. By the look of it this is caused by changes to make this thread safe.

Before: https://github.com/wneessen/go-mail/blob/v0.5.2/client.go#L1167-L1171
After: https://github.com/wneessen/go-mail/blob/v0.6.1/client.go#L1312-L1316

Note how c.smtpAuth is never used in the function, and it's value is only ever set or checked if it's nil, there is no other read action on c.smtpAuth.

Value being set: https://github.com/wneessen/go-mail/blob/v0.6.1/client.go#L511-L537

Only read action: https://github.com/wneessen/go-mail/blob/v0.6.1/client.go#L511-L537

To Reproduce

  1. Create a new client using NewClient and store it as variable client
  2. Implement a custom auth mechanism and apply it via client.SetSMTPAuthCustom
  3. Attempt to send an email to a server that requires authentication using client.DialWithContext(context.Background) and client.Send(msg)

Expected behaviour

The auth type should be respected.

Screenshots

No response

Attempted Fixes

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions