Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Mime] add DraftEmail#44311

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 0 commits intosymfony:6.1fromkbond:unsent-email
Dec 22, 2021
Merged

[Mime] add DraftEmail#44311

fabpot merged 0 commits intosymfony:6.1fromkbond:unsent-email
Dec 22, 2021

Conversation

@kbond
Copy link
Member

@kbondkbond commentedNov 27, 2021
edited
Loading

QA
Branch?6.1
Bug fix?no
New feature?yes
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PRtodo

I've had the need to create "draft" emails pre-filled with content/attachments. User's can then download these as a.eml, open with their email client, manipulate, then send. Thought I'd share my solution to see if this is something that would be acceptable in core.

Only needed a few minor adjustments toEmail that I wrapped up into anDraftEmail object:

  1. AddX-Unsent: 1 header (this marks the email as "draft" for clients that support this)
  2. Allow no From/To (user can add with their client)
  3. Remove Message-ID/Date headers (these will be added by the client)

Usage:

$content = (newDraftEmail()    ->html($twig->render(...))    ->attach(...)    ->toString();$response =newResponse($message->toString());$contentDisposition =$response->headers->makeDisposition(    ResponseHeaderBag::DISPOSITION_ATTACHMENT,'download.eml');$response->headers->set('Content-Type','message/rfc822');$response->headers->set('Content-Disposition',$contentDisposition);

@kbondkbondforce-pushed theunsent-email branch 2 times, most recently fromdfff60d to9da47c6CompareNovember 27, 2021 20:01
@kbondkbond changed the title[Mime] add UnsentEmail[Mime] add DraftEmailNov 27, 2021
@kbond
Copy link
MemberAuthor

kbond commentedNov 27, 2021
edited
Loading

Some details onX-Unsent header client support:

  • Virtually all versions of Outlook (desktop clients at least) support
  • Appears some versions of Apple Mail support with theX-Uniform-Type-Identifier: com.apple.mail-draft header (maybe worth adding). For versions that don't, it looks like there isan option to switch viewing a .eml to draft
  • Looks like Thunderbird 91+ supports natively and there is an addon forprevious versions

@kbondkbond modified the milestones:6.0,6.1Nov 27, 2021
@fabpot
Copy link
Member

@kbond Can you rebase on 6.1? Is it ready?

@stof
Copy link
Member

the point brought by@kbond in#44311 (comment) is not resolved yet: how should the mailer component behave if being asked to send a DraftEmail object ?

@kbond
Copy link
MemberAuthor

kbond commentedDec 20, 2021
edited
Loading

Rebased. Two remaining things:

@kbond
Copy link
MemberAuthor

kbond commentedDec 20, 2021
edited
Loading

To@GromNaN's original question. Mypersonal use-case for settingX-Unsent in an email is removed onceDraftEmail exists. Should I remove the check for this header inEmail andMailer? Then inMailer, we'd throw an exception if$message instanceof DraftEmail.

Otherwise having code in the parent class for the behavior of a child class sounds a bad design.

I agree completely if we were calling a method on the child from the parent. This is a "generic" header that can be added to anyMessage. (I don't feel strongly one way or the other)

@GromNaN
Copy link
Member

X-Unsent is actually recognized byThunderbird andOutlook. Therefore that's legit to support it in the baseEmail class.

@kbondkbondforce-pushed theunsent-email branch 2 times, most recently from7fbb065 toad833aaCompareDecember 22, 2021 00:57
@kbond
Copy link
MemberAuthor

ad833aa refactors this to haveensureValidity() throw the exception. I agree that having the exception thrown here makes the most sense.

@fabpot
Copy link
Member

Thank you@kbond.

@fabpotfabpot closed thisDec 22, 2021
@fabpotfabpot merged commit0d6e859 intosymfony:6.1Dec 22, 2021
@kbondkbond deleted the unsent-email branchDecember 22, 2021 13:26
@fabpotfabpot mentioned this pull requestApr 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@derrabusderrabusderrabus left review comments

@fabpotfabpotfabpot approved these changes

@GromNaNGromNaNGromNaN approved these changes

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@jderussejderusseAwaiting requested review from jderusse

@lyrixxlyrixxAwaiting requested review from lyrixx

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@wouterjwouterjAwaiting requested review from wouterj

@xabbuhxabbuhAwaiting requested review from xabbuh

@ycerutoycerutoAwaiting requested review from yceruto

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

6 participants

@kbond@fabpot@stof@GromNaN@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp