Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify FROM EMAIL #23

Open
tarhe opened this issue Jun 30, 2018 · 0 comments
Open

Allow to specify FROM EMAIL #23

tarhe opened this issue Jun 30, 2018 · 0 comments

Comments

@tarhe
Copy link

tarhe commented Jun 30, 2018

When using Sneaker with app deployed to ElasticBeanSteak on AWS and using AWS mail features, mails don't get sent because the FROM EMAIL field needs to be an email that is verified or can be verified.

You will get the error below:

Expected response code 250 but got code "554", with message "554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: Example [email protected], [email protected]

To solve this, allow the developer to specify From Email in the config file.

I solved mine like so:

File: config/sneaker.php

"sender" => [ "[email protected]", ],

File: vendor/squareboat/sneaker/src/Sneaker.php

` private function capture($exception)
{
$recipients = $this->config->get('sneaker.to');

    $sender = $this->config->get('sneaker.sender');

    $subject = $this->handler->convertExceptionToString($exception);

    $body = $this->handler->convertExceptionToHtml($exception);

    $this->mailer->to($recipients)->send(new ExceptionMailer($subject, $body, $sender));
}`

And then vendor/squareboat/sneaker/src/ExceptionMailer.php

`class ExceptionMailer extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;

/**
 * The subject of the message.
 *
 * @var string
 */
public $subject;

/**
 * The body of the message.
 *
 * @var string
 */
public $body;

/**
 * The sender of the message.
 *
 * @var string
 */
public $sender;

/**
 * Create a new message instance.
 *
 * @return void
 */
public function __construct($subject, $body, $sender)
{
    $this->subject = $subject;

    $this->body = $body;

    $this->sender = $sender;
}

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->from($this->sender[0])
                ->view('sneaker::raw')
                ->with('content', $this->body);
}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant