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

Support plaintext alt for HTML emails #5568

Merged
merged 4 commits into from Dec 25, 2018

Conversation

2 participants
@guysmoilov
Copy link
Contributor

guysmoilov commented Dec 24, 2018

This makes the sent messages less likely to be thrown away by spam filters, even if you DO want to be able to send HTML messages in general.

I know there's no opened issue or request for this, but I did it for myself and thought it would be nice to give you the chance to also add this very small feature that could potentially help people later on.

@Unknwon

This comment has been minimized.

Copy link
Member

Unknwon commented Dec 25, 2018

Thanks for the PR!

  1. The title of this PR looks confusing to me after reading the code, can you rephrase it?
  2. Please an a sample option after this line:

gogs/conf/app.ini

Lines 251 to 252 in 1f11c1f

; Use text/plain as format of content
USE_PLAIN_TEXT = false

@guysmoilov

This comment has been minimized.

Copy link
Contributor

guysmoilov commented Dec 25, 2018

@Unknwon No problem, but what would be a better title in your opinion?

@Unknwon

This comment has been minimized.

Copy link
Member

Unknwon commented Dec 25, 2018

Basically, to answer what does this PR actually do?

@guysmoilov guysmoilov changed the title Enable setting for automatic creation of plaintext alt for HTML emails Support plaintext alt for HTML emails Dec 25, 2018

@guysmoilov

This comment has been minimized.

Copy link
Contributor

guysmoilov commented Dec 25, 2018

Better?

}
}
msg.SetBody(contentType, body)
if switchedToPlaintext && setting.MailService.AddPlainTextAlt && !setting.MailService.UsePlainText {
msg.AddAlternative("text/html", htmlBody)

This comment has been minimized.

@Unknwon

Unknwon Dec 25, 2018

Member

From what I read on this line, seems like it is "Support HTML alt for plaintext emails"?

This comment has been minimized.

@guysmoilov

guysmoilov Dec 25, 2018

Contributor

That's a technical detail of how to setup the MIME message, but semantically it's the other way around. Mail clients will show the HTML as first priority, and the plaintext is just a backup.

This comment has been minimized.

This comment has been minimized.

@guysmoilov

guysmoilov Dec 25, 2018

Contributor

I'll add a code comment

@Unknwon

This comment has been minimized.

Copy link
Member

Unknwon commented Dec 25, 2018

LGTM, thanks again!

@Unknwon Unknwon merged commit 5702e4b into gogs:develop Dec 25, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment