-
-
Notifications
You must be signed in to change notification settings - Fork 866
Swift_MailTransport deprecated #866
Comments
The entire mail transport is deprecated. Use sendmail or smtp. |
And how I can send any mail if on my server sendmail is not installed ? |
If I understand correctly, |
The Mail transport is not deprecated. It just plain doesn't function at this point. |
I just spent several hours with my Laravel install trying to get it to send emails and got no debug messages. I only got some debug info that led me here when I was using artisan tinker. Does anyone know the last version of swiftmailer that actually worked with php's mail() function? |
What kind of info? |
My build info:
With the mail driver set to
And saw:
Which led me here. I'd just like to reiterate that even with php errors enabled (set in .env) I saw no exceptions thrown when running my controllers and attempting to send emails. To anyone else stumbling on this at a later point in time having the same issue as me, I found that Swiftmailer v5.4.1 seems to work perfectly. I'm not sure if any newer versions work, that's just the version that I know works based off of another Laravel install that I have that can actually send emails. |
Are you running emails via queue? That would explain not getting the warnings. |
I'm not queueing emails and I am hard coding the from address in my code. As for the deprecated message, it only shows up in tinker. From what I recall Sendmail was also unsuccessful, and SMTP is not allowed in the project . Additionally, isn't the mail driver just supposed to use php's mail() function? I don't understand why this would be failing when I can send messages from the mail function when I am able to run |
+1 what @blakethepatton is describing is more or less the same situation that we came across as well, which means that many Laravel installations are only one |
So is it because of the deprecated message? Perhaps submit a PR to just have it deprecated in the docs and remove the trigger_error |
…dominikhajduk) This PR was merged into the 2.7 branch. Discussion ---------- [Email] Add caution related to deprecate mail transport For current stable Symfony standard edition `swiftmailer/swiftmailer` version v5.4.6 is used. Since this one `mail` transport is deprecated. I think it's worth to mentioning this deprecation. swiftmailer/swiftmailer#866 >User Deprecated: The Swift_Transport_MailTransport class is deprecated since version 5.4.5 and will be removed in 6.0. Use the Sendmail or SMTP transport instead. Commits ------- 7138f84 Add caution related to deprecate mail transport
I'm very disappointed with this move, I know the I never use sendmail myself, usually Whilst |
+1 cyphix333 |
Not to mention that PHP's |
@crazyscience The documentation of |
Ok but some hosting does not allow to use sendmail. And for SMTP we need username and password. For some application, we did not have authentication |
@Rotzbua I and I think others are not saying you should use No, you shouldn't use If you have your own site and are using SwiftMailer, most of the time it probably won't be an issue as you can set it up to use |
I think the implementation of To be serous:
|
@Rotzbua those solutions are all well and good for the few people are aware that Also I'm curious what issues they're facing that makes php's I'd suggest that there be limited support for mail and have it be noted in the documentation rather than completely remove it. Removal will make it so that, as crazyscience said, "many Laravel installations are only one |
Please see the original pull requests: The MailTransporter was deprecated because of security reasons! Using an older version of the library because it doesn't give this deprecation is both dangerous and ignorant! Plus it breaks one of foundations of secure software development: http://fabien.potencier.org/don-t-use-php-libraries-with-known-security-issues.html The problem with the mail() function is rather complex: the php mail() function on Windows uses a build-in Sendmail binary that uses the configured smtp server (without authentication) perfectly doable. However on a posix (Linux/Unix/macOS) system it uses the local sendmail binary, and this is were things get complicated: When you pass additional arguments for sendmail (the from) PHP will escape the arguments (incorrectly). To fix this Swiftmailer escapes the arguments prior to passing them to the mail() function, however PHP repeats this escaping. And presto, we have double escaping bug. Add to this the fact that an e-mail address can formatted as a command, and your exploit is complete. Only using SMTP or Sendmail (directly) ensures there is no magic going on that breaks any of the protections. Keeping this transporter will only cause more problems in the future, it's already heavily limited for all features (compared to SMTP and sendmail) while both already available, mail() only abstract's this (that's all!). Sendmail or smtp is already available when you use the mail() function, so saying it's not possible plain wrong. It's possible however your was so kind to block popen/proc_open making it impossible to use this... ask them to enable this, because disabling this only stops the simplest of exploits and can be easily bypassed. About the "missing" deprecation message, this is intentional. You need to use a custom error handler (like the Symfony Debug component) to show these messages, as triggering them always would break your application.
This transporter is deprecated but will not be removed until the next major version. If your Composer constraints allow to install a new major version, this indicates a bigger problem. Secondly, I do hope you run a test after an update right? There is always a change a regression. |
Remove substitution for not defined variables
Please return mail transport driver! Leave the choice for developers! |
Can you be a bit more specific about that, please? For example, I've P.S. and, yes, having that settings makes swiftmailer unusable without |
Many, many and many hosting companies disabling proc_* function for secrutity reason and allow just one way to sedmail mail is usng PHP mail function. So, SwiftMaler is not more usable in many sites hosting provider. Good job! :))) |
Poor move closing this - if you're going to close it then at least reply to the issues people have brought up in this thread to support the decision you have made, not just close it because "that's the way we're going and tough luck if you don't like it". |
@cyphix333 Please, read the thread. I don't see what we can add to what @sstok already said. The MailTransporter was deprecated because of security reasons. We don't want to keep something that will always have security issues. |
Well, I, as sysadmin in the company where developers using this package, disagree that mail() is more insecure than calling to exec-functions of any kind (and, especially, executing of a hardcoded commands, when it is no way to fix assumptions of this package developers)... And it's a bit overkill to setup a full smtp server with all the proper setup (incl. dns) for each dev/staging container/VM. |
You are still able to implement the transport yourself (which basically is just copy and pasting some code). |
Ok so, what is the last version number to continue to use SwiftMailer with composer ? |
I'm quite aware why you deprecated it, but my previous post was addressing the concerns people had. Namely the ones about that many hosts have disabled ...and the issues I bought up about using it in large-scale software, where again, you have no control over what host the user will use and is even worse than a client as you can't really advise them what host to use because a package you use chooses not to use the On top of that, another point I made was that many of these same users don't have the technical know how to setup their SMTP settings; you are turning this into something that can be utilised by developers on the front end as well as the back. |
@babeuloula It seems that 5.4.4 was the last version before the mail transport got deprecated and it got removed in 6.0.0. https://github.com/swiftmailer/swiftmailer/blob/master/CHANGES |
@cyphix333 5.4.1 for sure didn't give the depricated notice. When I joined this issue I was having issues with 5.4.5 not running the |
@blakethepatton @babeuloula My bad; I just checked the changelog again...... 5.4.* doesn't have the mail transport removed, (it gets removed in 6.0.0), but it got deprecated in 5.4.5. https://github.com/swiftmailer/swiftmailer/blob/master/CHANGES I think I remember now why I setup my composer.json like that; since it's for my own site I didn't need the mail transport but didn't want to go to 6.0.0 because I don't run PHP 7. I will update my post above now. |
How can I send a mail with a postfix server |
On public hostings, Is there any way how to make |
Hello,
The constructor Swift_MailTransport is deprected
But on your documentation (http://swiftmailer.org/docs/sending.html) you use this constructor.
What is the good way ?
Thanks
The text was updated successfully, but these errors were encountered: