Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email service | UseHTML is never set #387

Open
adityathebe opened this issue Sep 14, 2023 · 5 comments · May be fixed by #388
Open

Email service | UseHTML is never set #387

adityathebe opened this issue Sep 14, 2023 · 5 comments · May be fixed by #388

Comments

@adityathebe
Copy link

When setting the content type to HTML in here

conf := service.config
var contentType string
if conf.UseHTML {
contentType = fmt.Sprintf(contentMultipart, service.multipartBoundary)
} else {
contentType = contentPlain
}

the config is read from the service struct. However, service.config.UseHTML is never populated.

What's populated is the clone of the config https://github.com/containrrr/shoutrrr/blob/main/pkg/services/smtp/smtp.go#L68-L71


I wanted to create a PR for this but running off the main branch gave me this error.

server did not accept the handshake: 555 5.5.2 Syntax error

Even checking out to the last commit in v0.8.0 gave me the same error. Not sure what's going on in here.

@piksel
Copy link
Member

piksel commented Sep 16, 2023

The .UseHTML is set if it's in the service URL (&usehtml=yes). The config is updated here:

if err := service.config.setURL(&pkr, configURL); err != nil {
return err
}

How are you using shoutrrr? As a library or in another software?

There is however a problem that you identified. If you add temporary configuration overrides through the params, and you only specify usehtml there, it won't set the correct headers.


server did not accept the handshake

That sounds like a TLS problem. What e-mail provider are you using? Also, does it work with another version?

@piksel piksel linked a pull request Sep 16, 2023 that will close this issue
@adityathebe
Copy link
Author

How are you using shoutrrr? As a library or in another software?

As a library

That sounds like a TLS problem. What e-mail provider are you using? Also, does it work with another version?

I am using Yandex. The same credential works when I am checked out to v0.8.0 tag though.

@piksel
Copy link
Member

piksel commented Sep 18, 2023

Even checking out to the last commit in v0.8.0 gave me the same error.

The same credential works when I am checked out to v0.8.0 tag though.

I'm a bit confused here, what two versions are you comparing?

@adityathebe
Copy link
Author

Yea, it was slightly confusing.

The smtp service with my credentials works with go get -u github.com/containrrr/shoutrrr v0.8.0

I wanted to make changes to the source code to fix the useHTML issue, so I cloned the repo and then pointed shoutrrr to the cloned repo

# "go.mod"

replace "github.com/containrrr/shoutrrr" => ../shoutrrr

Now, with no changes made to the source code, I get the server did not accept the handshake: 555 5.5.2 Syntax error error. Assumed some new changes commits since v0.8.0 caused this issue. So I checked out to the exact commit at which v0.8.0 was released.

git checkout ddf280ee3d7150e4b3a09f30a5e37c3817eb2def

But I still get the handshake error.

However, checking out to the exact tag instead of the commit works for some reason.

git checkout tags/v0.8.0

@piksel
Copy link
Member

piksel commented Sep 18, 2023

The tag is on another branch, but there are no changes to the smtp service. Perhaps there is something else on the latest branch that makes a difference...

Actually, I found it. The default hostname was hot fixed in release but never backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants