weblee / Mandrill

Mandrill Laravel 5 Package
MIT License
24 stars 4 forks source link

Please help invalid-sender. #7

Open kfahmi opened 7 years ago

kfahmi commented 7 years ago

help me, im using Laravel 5, but the email didnt sent to destination. when i print $result[0]["reject_reason"] the result is invalid-senderNULL,

can you help me??

if im using mandrill for sendmail without this class, its work. but i need your class to using mandrill template but the email didnt sent. because the invalid sender.

here is my code.

`namespace App\Services;

use Weblee\Mandrill\Mail;

class WebleeMail{

private function welcomeEmail($userEmail,$userName){
    try{
        $template_name = 'forgot_password';
        $template_content = array(
            array(
                'name' => 'test',
                'content' => 'test'
            )
        );
        $message = array(
            'to' => array(
                array(
                    'email' =>  $userEmail,
                    'name'  =>  $userName,
                    'type'  => 'to'
                )
            )
        );
        $result = \MandrillMail::messages()->sendTemplate($template_name, $template_content, $message);
        if($result[0]["status"]=="sent" AND !$result[0]["reject_reason"]){
            return true;
        }
        else{
            return $result[0]["reject_reason"];
        }
    }
    catch(Exeption $e){
        return false;
    }
}

public function testEmail(){
    echo $this->welcomeEmail("khairulfahmi.baz@gmail.com","test");
}

}`

zenfiric commented 2 years ago

Well, you are missing the from: field.