【问题标题】:What is the best practice to sent a text message to your self from Laravel application?从 Laravel 应用程序向自己发送短信的最佳做法是什么?
【发布时间】:2015-10-06 17:34:22
【问题描述】:

首先,如果这是可能的事情,我不完全是。 我正在尝试通过 短信将我的 laravel 应用程序中的微小信息发送到我的手机。

我想将信息发送到 T-Mobile 手机样本:+19786770001

<?php

$ip = trim(shell_exec("dig +short myip.opendns.com @resolver1.opendns.com"));

$text = Mail::send('emails.site_visit', array('ip' => $ip ) ,
      function ($ip) {
          $ip->from(env('MAIL_USERNAME') , 'sample gmail');
          $ip->to(env('+19786770001') , 'Sample\'s Site ')->subject(' Site Visit Report ' );
      });

?>

为了让我看到我的内容,我必须点击Attachment.html

  • 我怎么老是看到Attachement.html
  • 如何在文本消息中而不是在 html 文件中显示内容?
  • 正确的做法是什么?甚至可能吗?

对此的任何提示/建议将不胜感激!

【问题讨论】:

    标签: php laravel laravel-5 sms sendmail


    【解决方案1】:

    删除主题(因为 SMS 不使用它)并尝试以纯文本形式发送。

    Mail::send(['text' => 'emails.site_visit'], array('ip' => $ip ), function ($ip) {
        $ip->from(env('MAIL_USERNAME');
        $ip->to('<PHONE_NUMBER>@tmomail.net');
    });
    

    【讨论】:

    • 好的。我现在就试试。谢谢。
    • 在我的site_visit.blade.php 中只包含{{$ip}} 这是一个ip_addess 的计划文本。
    • 我想,你已经接近了。消息消失了,因为我按照您的建议将其取下,但在我的短信应用程序中,我仍然看到 Attachment.html 。 :(
    • env('+19786770001') 返回的项目是一个有效的电话号码,后跟@tmomail.net
    • 我确定我的是TMobile - 我只是不想把它公之于众。但是我发的那个,我不确定。为什么?
    猜你喜欢
    • 1970-01-01
    • 2012-05-17
    • 2016-07-03
    • 2014-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多