SmtpUtf8Handler.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2018 Christian Schmidt
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * An ESMTP handler for SMTPUTF8 support (RFC 6531).
  11. *
  12. * SMTPUTF8 is required when sending to email addresses containing non-ASCII
  13. * characters in local-part (the substring before @). This handler should be
  14. * used together with Swift_AddressEncoder_Utf8AddressEncoder.
  15. *
  16. * SMTPUTF8 mode is enabled unconditionally, even when sending to ASCII-only
  17. * addresses, so it should only be used with an outbound SMTP server that will
  18. * deliver ASCII-only messages even if the next hop does not support SMTPUTF8.
  19. *
  20. * @author Christian Schmidt
  21. */
  22. class Swift_Transport_Esmtp_SmtpUtf8Handler implements Swift_Transport_EsmtpHandler
  23. {
  24. public function __construct()
  25. {
  26. }
  27. /**
  28. * Get the name of the ESMTP extension this handles.
  29. *
  30. * @return string
  31. */
  32. public function getHandledKeyword()
  33. {
  34. return 'SMTPUTF8';
  35. }
  36. /**
  37. * Not used.
  38. */
  39. public function setKeywordParams(array $parameters)
  40. {
  41. }
  42. /**
  43. * Not used.
  44. */
  45. public function afterEhlo(Swift_Transport_SmtpAgent $agent)
  46. {
  47. }
  48. /**
  49. * Get params which are appended to MAIL FROM:<>.
  50. *
  51. * @return string[]
  52. */
  53. public function getMailParams()
  54. {
  55. return ['SMTPUTF8'];
  56. }
  57. /**
  58. * Not used.
  59. */
  60. public function getRcptParams()
  61. {
  62. return [];
  63. }
  64. /**
  65. * Not used.
  66. */
  67. public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
  68. {
  69. }
  70. /**
  71. * Returns +1, -1 or 0 according to the rules for usort().
  72. *
  73. * This method is called to ensure extensions can be execute in an appropriate order.
  74. *
  75. * @param string $esmtpKeyword to compare with
  76. *
  77. * @return int
  78. */
  79. public function getPriorityOver($esmtpKeyword)
  80. {
  81. return 0;
  82. }
  83. /**
  84. * Not used.
  85. */
  86. public function exposeMixinMethods()
  87. {
  88. return [];
  89. }
  90. /**
  91. * Not used.
  92. */
  93. public function resetState()
  94. {
  95. }
  96. }