spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

All Messages going to Log #193

Closed iAmKevinMcKee closed 4 years ago

iAmKevinMcKee commented 4 years ago

I am trying to get Mailcoach installed and use SES as my driver.

I am able to send emails through SES outside of mailcoach (for example, the password reset email that comes standard with Laravel).

However, when I try to send any email with Mailcoach, it uses the log driver. For example, here is the result of my job from telescope. Note near the very end where the mailer is set to log.

{
"mailable": {
"class": "Spatie\Mailcoach\Mails\ConfirmSubscriberMail",
"properties": {
"theme": "mailcoach::mails.layout.mailcoach",
"subscriber": {
"id": 2,
"email_list_id": 1,
"email": "mckee.kevin@gmail.com",
"first_name": null,
"last_name": null,
"extra_attributes": [
],
"uuid": "53a14f03-8d42-4e15-86c0-c18c86e58b3c",
"subscribed_at": null,
"unsubscribed_at": null,
"created_at": "2020-05-18T02:00:00.000000Z",
"updated_at": "2020-05-18T02:00:00.000000Z",
"email_list": {
"id": 1,
"uuid": "9bde2fad-3b1b-4c95-9500-02ab39002ae0",
"name": "Newsletter",
"campaigns_feed_enabled": "1",
"default_from_email": "kevin@kevinmckee.me",
"default_from_name": "Kevin McKee",
"allow_form_subscriptions": false,
"redirect_after_subscribed": null,
"redirect_after_already_subscribed": null,
"redirect_after_subscription_pending": null,
"redirect_after_unsubscribed": null,
"requires_confirmation": true,
"confirmation_mail_subject": null,
"confirmation_mail_content": null,
"confirmation_mailable_class": null,
"campaign_mailer": "log",
"transactional_mailer": "log",
"send_welcome_mail": null,
"welcome_mail_subject": null,
"welcome_mail_content": null,
"welcome_mailable_class": null,
"welcome_mail_delay_in_minutes": 0,
"report_recipients": null,
"report_campaign_sent": false,
"report_campaign_summary": false,
"report_email_list_summary": false,
"email_list_summary_sent_at": null,
"created_at": "2020-05-18T01:37:00.000000Z",
"updated_at": "2020-05-18T01:37:00.000000Z"
}
},
"confirmationUrl": "https://kevinmckee.test/mailcoach/confirm-subscription/53a14f03-8d42-4e15-86c0-c18c86e58b3c",
"locale": null,
"from": [
],
"to": [
{
"name": null,
"address": "mckee.kevin@gmail.com"
}
],
"cc": [
],
"bcc": [
],
"replyTo": [
],
"subject": null,
"view": null,
"textView": null,
"viewData": [
],
"attachments": [
],
"rawAttachments": [
],
"diskAttachments": [
],
"callbacks": [
],
"mailer": "log"
}
},
"tries": null,
"timeout": null
}

Here is what I get when I run tinker and execute config('mailcoach')

[
     "mailer" => "ses",
     "campaign_mailer" => "ses",
     "transactional_mailer" => "ses",
     "date_format" => "Y-m-d H:i",
     "replacers" => [
       "Spatie\Mailcoach\Support\Replacers\WebviewReplacer",
       "Spatie\Mailcoach\Support\Replacers\SubscriberReplacer",
       "Spatie\Mailcoach\Support\Replacers\EmailListReplacer",
       "Spatie\Mailcoach\Support\Replacers\UnsubscribeUrlReplacer",
       "Spatie\Mailcoach\Support\Replacers\CampaignReplacer",
     ],
     "editor" => "Spatie\Mailcoach\Support\Editor\TextEditor",
     "perform_on_queue" => [
       "calculate_statistics_job" => "mailcoach",
       "send_campaign_job" => "send-campaign",
       "send_mail_job" => "send-mail",
       "send_test_mail_job" => "mailcoach",
       "process_feedback_job" => "mailcoach-feedback",
       "import_subscribers_job" => "mailcoach",
     ],
     "queue_connection" => "",
     "throttling" => [
       "enabled" => true,
       "redis_connection_name" => "default",
       "redis_key" => "laravel-mailcoach",
       "allowed_number_of_jobs_in_timespan" => 10,
       "timespan_in_seconds" => 1,
       "release_in_seconds" => 5,
     ],
     "actions" => [
       "calculate_statistics" => "Spatie\Mailcoach\Actions\Campaigns\CalculateStatisticsAction",
       "prepare_email_html" => "Spatie\Mailcoach\Actions\Campaigns\PrepareEmailHtmlAction",
       "prepare_subject" => "Spatie\Mailcoach\Actions\Campaigns\PrepareSubjectAction",
       "prepare_webview_html" => "Spatie\Mailcoach\Actions\Campaigns\PrepareWebviewHtmlAction",
       "convert_html_to_text" => "Spatie\Mailcoach\Actions\Campaigns\ConvertHtmlToTextAction",
       "personalize_html" => "Spatie\Mailcoach\Actions\Campaigns\PersonalizeHtmlAction",
       "personalize_subject" => "Spatie\Mailcoach\Actions\Campaigns\PersonalizeSubjectAction",
       "retry_sending_failed_sends" => "Spatie\Mailcoach\Actions\Campaigns\RetrySendingFailedSendsAction",
       "send_campaign" => "Spatie\Mailcoach\Actions\Campaigns\SendCampaignAction",
       "send_mail" => "Spatie\Mailcoach\Actions\Campaigns\SendMailAction",
       "send_test_mail" => "Spatie\Mailcoach\Actions\Campaigns\SendTestMailAction",
       "confirm_subscriber" => "Spatie\Mailcoach\Actions\Subscribers\ConfirmSubscriberAction",
       "create_subscriber" => "Spatie\Mailcoach\Actions\Subscribers\CreateSubscriberAction",
       "import_subscribers" => "Spatie\Mailcoach\Actions\Subscribers\ImportSubscribersAction",
       "send_confirm_subscriber_mail" => "Spatie\Mailcoach\Actions\Subscribers\SendConfirmSubscriberMailAction",
       "send_welcome_mail" => "Spatie\Mailcoach\Actions\Subscribers\SendWelcomeMailAction",
       "update_subscriber" => "Spatie\Mailcoach\Actions\Subscribers\UpdateSubscriberAction",
     ],
     "redirect_unauthorized_users_to_route" => "login",
     "guard" => null,
     "middleware" => [
       "web",
       "Spatie\Mailcoach\Http\App\Middleware\Authenticate",
       "Spatie\Mailcoach\Http\App\Middleware\Authorize",
       "Spatie\Mailcoach\Http\App\Middleware\SetMailcoachDefaults",
     ],
     "import_subscribers_disk" => "public",
     "models" => [
       "campaign" => "Spatie\Mailcoach\Models\Campaign",
       "email_list" => "Spatie\Mailcoach\Models\EmailList",
       "subscriber" => "Spatie\Mailcoach\Models\Subscriber",
     ],
     "ses_feedback" => [
       "configuration_set" => "mailcoach",
     ],
   ]

I have already run php artisan config:clear and php artisan cache:clear and I just cannot figure out how mailcoach is using the log driver.

Thanks for your help.

freekmurze commented 4 years ago

Maybe you have not restarted your queues and they are still making use of some old mail config?

You could try to create a new job, let it write to output of config('mail') to the log file, and dispatch it.

iAmKevinMcKee commented 4 years ago

I terminated and restarted horizon. Still seeing mailcoach emails go to log.

Here's the config('mail') from a new job.

array (
  'default' => 'ses',
  'mailers' => 
  array (
    'smtp' => 
    array (
      'transport' => 'smtp',
      'host' => 'smtp.mailtrap.io',
      'port' => '2525',
      'encryption' => NULL,
      'username' => NULL,
      'password' => NULL,
      'timeout' => NULL,
      'auth_mode' => NULL,
    ),
    'ses' => 
    array (
      'transport' => 'ses',
    ),
    'mailgun' => 
    array (
      'transport' => 'mailgun',
    ),
    'postmark' => 
    array (
      'transport' => 'postmark',
    ),
    'sendmail' => 
    array (
      'transport' => 'sendmail',
      'path' => '/usr/sbin/sendmail -bs',
    ),
    'log' => 
    array (
      'transport' => 'log',
      'channel' => NULL,
    ),
    'array' => 
    array (
      'transport' => 'array',
    ),
  ),
  'from' => 
  array (
    'address' => 'kevin@kevinmckee.me',
    'name' => 'Laravel',
  ),
  'markdown' => 
  array (
    'theme' => 'default',
    'paths' => 
    array (
      0 => '/Users/kevinmckee/Code/kevinmckee/resources/views/vendor/mail',
    ),
  ),
)
freekmurze commented 4 years ago

That's very strange. I'm thinking it's something specific to your app and not a bug in Mailcoach. Could you try installing it in a fresh copy of Laravel?

iAmKevinMcKee commented 4 years ago

Is there anything else you can think of that I could try to debug? I just created this site a few days ago and there's nothing to it. It's a personal site with single page. If not for using mailcoach to get email subscribers, it would have been a Jigsaw static site.

I will try to spin up a new site and reinstall everything and check tonight, but please let me know if you can think of anything else.

iAmKevinMcKee commented 4 years ago

Turns out my problem was that when I created the list, the MAIL_MAILER was 'log' so it set that value on the EmailList model. I didn't realize this setting was available in the UI.

I just had to go here and update the mailer:

image