-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Proposal for #31 #1011
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
Proposal for #31 #1011
Conversation
Doc comments for 'email' updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just a number? Isn't an array of errors better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Particular libraries may have a problem with that.
|
@klimov-paul I'm still reviewing your PR. Here are my initial thoughts about it:
@yiisoft/core-developers Could you help review this PR too? The mail component should be a core app component, I think. |
|
There is no need to haste with this one – we have enough time, I think. I have only meant this PR is a little scratch at the moment, but that is because its idea requires consideration. Some architecture clarifications:
|
… reference. Doc comments at '\yii\email' have been extended.
|
1, 2). I mainly want to remove 3). What I meant is mainly about composing mail content via view template files. We don't need to consider templates in database, just like we don't need to consider normal view templates stored in database. Should we really care about that, it probably can be solved by developing a new View class, which is independent of the mailer feature, as long as the new view class follows the same interface. |
The problem is I don’t know which methods should compose the email message interface. It is too complicated. Email has a lot of possible headers, in common situations only a few of them are needed, but it could be situations, which require specific headers to be set. Also there are such complex problems, like embedded images, which creation and insertion in the message content is not a trivial.
Agreed. I’ll see what I can do. |
I mean I can create a email interfaces and email classes, which implement them, wrapping the Swift. But in this case, I am afraid, these interfaces would be bound to the Swift interfaces, for ill or good. |
|
I think the situation is a bit like our |
It can not! Yii View class does not resolve the view name. ‘\yii\base\View’ only renders the files given by explicit file name. It does not convert view short name like ‘contact/body’ into actual file name. This means, if I would bind email message to the View component, I have to resolved view name inside the Message class itself. So if I want to store email templates inside the database, replacing the View component would not help me – I have to override the Message class. |
|
@klimov-paul regarding to the mail headers - just add methods for the common headers, like: From, Reply-To, Return-Path. For the other custom headers just make a method "addHeader($name, $content)" and be done with it. As to the API and vendorMail - I looks a little bit too overcomplicated, but you and @qiangxue are handling it well :) I think that the real think is when people use Amazon services or some other could service for e-mail instead of SwiftMail with SMTP. |
|
Migrated to #1049 |
Here is my proposal for #31: email component
Here I have created an abstraction layer for the email mailer and message.
I have created ‘Vendor*’ classes, which should help to created wrappers over existing email libraries.
By default solution uses SwiftMailer, but you should be able to switch it to any other library such as Zend/Email without much effots.
This solution of course need some adjustments, feel free to propose ones.