10000 Syntax to create an email by grelu · Pull Request #7924 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Syntax to create an email #7924 8000

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

Closed
wants to merge 2 commits into from
Closed

Syntax to create an email #7924

wants to merge 2 commits into from

Conversation

grelu
Copy link
Contributor
@grelu grelu commented May 20, 2017

With swiftmailer 6.0.1 and Symfony 3.2.8, the good syntax to create an email is :
$message = new \Swift_Message('Hello Email');

With swiftmailer v6.0.1 and Symfony 3.2.8, the good syntax to create an email is :
$message = new \Swift_Message('Hello Email');
@grelu grelu changed the title Update email.rst Syntax to create an email May 20, 2017
@weaverryan
Copy link
Member

We can't assume that users have 6.0 yet. But, the Swift_Message class isn't new... so does this syntax also work in Swiftmailer 5?

Also, there are other spots we need to update - you can find them if you run:

git grep newInstance

Thanks - we have to make sure the details are correct, but this is a good change. And the old way definitely does not work in Swiftmailer 6

@grelu
Copy link
Contributor Author
grelu commented May 21, 2017

Apparently, no, it's a new method to create a message in 6.0. I have read the 5.x version of the documentation and it is not the same way of doing things :
https://github.com/swiftmailer/swiftmailer/blob/5.x/doc/messages.rst
So, what should I do now ? (I have committed the other spots changes)

@weaverryan
Copy link
Member

Hmm, but check out the Swift_Message::newInstance() class on the 5.x branch - https://github.com/swiftmailer/swiftmailer/blob/5.x/lib/classes/Swift/Message.php#L73-L76. It's not doing anything special: just creating a new instance of itself. So it looks like the docs were just not using the new method. Even going WAY back to version 4.0... I can't see a reason why we were using newInstance instead of simply new Swift_Message().

@weaverryan
Copy link
Member

In other words 👍 - I think this is ready for merge... and into the 2.7 branch: this syntax appears to always have been valid.

Status: Reviewed

@grelu
Copy link
Contributor Author
grelu commented May 21, 2017

Perfect !

Copy link
Member
@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Ryan. The newInstance() method didn't do anything special in 5.x version, so it's safe to update this.

👍 @grelu thanks for fixing this and congrats on your first contribution to docs!

@javiereguiluz javiereguiluz mentioned this pull request May 21, 2017
@grelu
Copy link
Contributor Author
grelu commented May 21, 2017

You're welcome and thank you !

@xabbuh xabbuh added this to the 2.7 milestone May 22, 2017
@xabbuh
Copy link
Member
xabbuh commented May 24, 2017

Thank you @grelu.

xabbuh added a commit that referenced this pull request May 24, 2017
This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #7924).

Discussion
----------

Syntax to create an email

With swiftmailer 6.0.1 and Symfony 3.2.8, the good syntax to create an email is :
$message = new \Swift_Message('Hello Email');

Commits
-------

f5f0f7c Syntax to create an email
@xabbuh xabbuh closed this May 24, 2017
@@ -39,9 +39,8 @@ In this case, the SOAP service will allow the client to call a method called
public function hello($name)
{

$message = \Swift_Message::newInstance()
$message = new \Swift_Message('Hello Service')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an implementation detail, we should use $message = $this->mailer->createMessage() instead.

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

Successfully merging this pull request may close these issues.

6 participants
0