首页 > 解决方案 > 使用 nexmo 在 laravel 中将发件人名称从验证更改为我的公司名称

问题描述

我尝试将 nexom "verify" 提供的消息标题更改为我的公司名称。我升级了我的 nexmo 账户并把钱存入其中。我尝试使用但不工作。

这是我的通知

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
//use App\admin\Course;

class ConfirmedCourse extends Notification
{
    use Queueable;
    protected $course;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($course)
    {
     $this->course = $course;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['nexmo'];
    }

 public function toNexmo($notifiable)
    {
      try {
     $message = new NexmoMessage(); 
     $message->from('basma center')->content($this->course)
         ->unicode();
     return $message;
    }catch (\Exception $e) {
    $e->getMessage();
    }
 }  
}

在此处输入图像描述

请问我该如何解决这个问题??预先感谢

标签: laravelnotificationsnexmo

解决方案


查看来自 Laravel 的代码,我相信您所做的是正确的,因为看起来他们将您的“来自”设置传递回了通知堆栈。我唯一能想到的可能是国家/地区限制,因为不同的国家/地区对发件人数据有不同的 SMS 要求。

您可能需要查看国家/地区特定功能和建议列表,以查看运营商是否忽略了这一点。

还要记住,Laravel 通知是纯 SMS 消息,它们不是我们的验证产品。您可以使用原始 SMS 设置为“发件人”选项的内容受到更多限制(请参阅上面的国家/地区限制)。


推荐阅读