您好我正在使用bogard / mailgun库发送电子邮件 我已经遵循了步骤 https://packagist.org/packages/bogardo/mailgun
我在控制器中调用了以下代码
Mailgun::send('emails.welcome', $data, function($message)
{
$message->to('foo@example.com', 'John Smith')->subject('Welcome!');
});
从上面的代码中显示错误
Non-static method Bogardo\Mailgun\Mailgun::send() should not be called statically, assuming $this from incompatible context
这里发送功能代码
namespace Bogardo\Mailgun;
use Bogardo\Mailgun\Mailgun\Lists;
use Bogardo\Mailgun\Mailgun\MailgunApi;
use Bogardo\Mailgun\Mailgun\Message;
use Closure;
use Illuminate\View\Factory;
class Mailgun extends MailgunApi
{
/**
* Send a new message.
*
* @param string|array $view
* @param array $data
* @param Closure|string $callback
* @param bool $mustInit
*
* @return object Mailgun response containing http_response_body and http_response_code
*/
public function send($view, array $data, $callback, $mustInit = true)
{
if ($mustInit) {
$this->_init();
}
$this->callMessageBuilder($callback, $this->message);
$this->getMessage($view, $data);
return $this->mailgun(true, config('mailgun.api_key'))->sendMessage(config('mailgun.domain'), $this->getMessageData(), $this->getAttachmentData());
}
}