Skip to content

Commit

Permalink
fix #246 (#273)
Browse files Browse the repository at this point in the history
* Bump coverage from 7.2.3 to 7.3.0

Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.2.3 to 7.3.0.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.2.3...7.3.0)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix #246

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
theruziev and dependabot[bot] authored Dec 9, 2023
1 parent 2d63085 commit d74a50f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
interval: monthly
open-pull-requests-limit: 10
ignore:
- dependency-name: pytest-asyncio
Expand Down
3 changes: 2 additions & 1 deletion async_sender/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ def as_string(self) -> str:
alternative.attach(MIMEText(self.html, "html", self.charset))
msg.attach(alternative)

msg["Subject"] = Header(self.subject, self.charset)
# For improve deliver-ability
# https://github.com/theruziev/async_sender/issues/228
if self.subject is not None and self.subject.isascii():
msg["Subject"] = Header(self.subject, USASCII)
else:
msg["Subject"] = Header(self.subject, self.charset)

msg["From"] = self.from_address
msg["To"] = ", ".join(self.to)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_async_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def test_extra_headers():
)
assert "Extra-Header-Test: Test" in str(msg)

def test_message_subject_charset():
msg = Message(subject="hello world")
assert "hello world" in msg.as_string()
msg_utf8_subject = Message(subject="Привет мир")
assert "=?utf-8?b?0J/RgNC40LLQtdGCINC80LjRgA==?=" in msg_utf8_subject.as_string()

def test_mail_and_rcpt_options():
msg = Message()
Expand Down

0 comments on commit d74a50f

Please sign in to comment.