Skip to content

3rdparty swiftmailer NTLMauth throws error but mail is sent #6775

@tripcreator

Description

@tripcreator

there is already a bug report and solution so possible to include it in the next update?

Undefined offset: 1 at /var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#299

swiftmailer/swiftmailer#794

So, I've run into an issue if the username for the SMTP server doesn't have an "@domain.com" attached to it. The SMTP server I'm connecting to fails auth if you send it "username@domain.com" as the username and works if you use just "username".

However, if I do use just "username", the auth works and the mail goes through, but a notice gets thrown for "undefined offset" from this code, which tries to explode the string into an array based on the presence of "@":

https://github.com/swiftmailer/swiftmailer/blob/5.x/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php#L293-L302

Interestingly enough, if I change the "username" to just "username@" it actually works (auth works and mail is sent) and and there is no notice thrown.

So could a solution be to add a simple check there to see if there is a "@" present or not and then return the values accordingly (maybe $domain is null)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions