【问题标题】:Laravel 4 Email in development environment开发环境中的 Laravel 4 电子邮件
【发布时间】:2013-10-04 12:12:43
【问题描述】:

Mail::pretend() 仅记录 sending mail 被伪装。是否可以在开发过程中将呈现的电子邮件的输出转储到文件或日志中?

【问题讨论】:

    标签: email laravel laravel-4


    【解决方案1】:

    我开始使用的一个很好的选择是https://papercut.codeplex.com/

    您将 smtp 设置设置为路由到这个简单的程序,它会在类似 Outlook 的应用程序中拦截电子邮件,就好像电子邮件真的发出了一样

    【讨论】:

      【解决方案2】:

      如果您将渲染视图缓存在变量中,那么您可以这样做,例如

      $renderedView = View::make('email.index', $data); // email(folder)/index(file);
      // Now you can dump the output ($renderedView) to a file
      File::put('path/to/file', $renderedView)
      
      $data['content'] = $renderedView;
      Mail::send('emails.welcome', $data, function($message)
      {
          // code here
      });
      

      【讨论】:

        猜你喜欢
        • 2015-11-16
        • 2017-05-18
        • 2021-03-21
        • 2014-04-04
        • 2016-02-25
        • 2018-12-07
        • 1970-01-01
        • 1970-01-01
        • 2016-10-11
        相关资源
        最近更新 更多