Email.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace common\helpers;
  3. use Yii;
  4. class Email
  5. {
  6. /**
  7. * @param string $email
  8. * @param string $userName
  9. * @param string $password
  10. */
  11. public static function sendRegistrationEmail(string $email, string $userName, string $password)
  12. {
  13. $subject = 'Elken Welcome You.';
  14. // $str = "<p>恭喜! 恭喜您成功注册到Elken Global系统和家庭。 我们致力于打造你来打造他人 使用下面提供的链接登录您的后台办公室 用户名=".$userName." 密码=".$password." 我们建议您将密码更改为您容易记住的密码。 如需进一步查询,请随时联系+23480 3413 0554 我们致力于确保您成功。 再次恭喜!</p>";
  15. $str = "
  16. <p>CONGRATULATIONS!</p>
  17. <p>Congratulations on your successful registration into Elken Global system and family. We are committed to building you to build others Login to your back office using the link provided below <a href='https://ngds.elken.com/#/login'>Member Management System</a> Username = ".$userName." Password = ".$password."</p>
  18. <p>We recommend that you change your password to what you will easily remember. For further inquiries do not hesitate to contact +23480 3413 0554 We are committed to ensuring that you succeed. </p>
  19. <p>Once again congratulations!</p>
  20. ";
  21. $message = \Yii::t('app', $str);
  22. $mailer = Yii::$app->mailer;
  23. $mailer->useFileTransport = false;
  24. $mailer->compose()
  25. ->setFrom('eshop-noreply@elken.com')
  26. ->setTo($email)
  27. ->setSubject($subject)
  28. ->setHtmlBody($message)
  29. ->send();
  30. }
  31. }