marcellopato's avatar

Email Marketing MailChimp like

Hello guys! I´ve set Queue to send an email successfully sending via job table. Now, I want to pass an Id from a content table, so the email sends a particular content, like choosing a campaign on MailChimp.

Let´s see some code: CampanhaController.php


    public function enviaCampanhas(Campanha $campanha)
    {
        $sendCampanha = Campanha::first();
        // return $sendCampanha->id;
        SendCampanha::dispatch($sendCampanha->id)
                ->delay(now()->addSeconds(5));
        return 'Campanha ' . $sendCampanha->nome . ' enviada';
        
    }

Now,. some code from SendCampanhas.php maiable


  public function build(Request $request)
    {
        $campanha = Campanha::where('id', '=', $campanha);
        return $this->view('layouts.campanhas.envia', compact('campanha'));
    }

Some code from view

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    {{-- <title>{{ $campanha->nome }}</title> --}}
    <!-- Styles -->
    <link href="https://carbonno.nnid.test/css/app.css" rel="stylesheet">
    {{-- <link href="{{ asset('css/app.css') }}" rel="stylesheet"> --}}
</head>
<body>
    <span></span>
    <div class="content">
        <h1>AQUI VAI O  TEXTO DA CAMPANHA DO CLIENTE</h1>
    </div>
    {!! $campanha !!}
    <span class="text-center">Caso não queira mais receber essas mensagens, <a href="#!" target="_blank">clique aqui</a></span>
</body>
</html>

On the end of the day, I want to pass to this view the content from 'campanhas' table, 'texto' filed.

Looks like I can pass the variables from controller to blade, so i´ve returned the results, but it doesen´t work passing to the view. The ``php artisan queue:wo can´t process like showing:

[2018-08-23 18:06:56][263] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:56][264] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:56][265] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][266] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][267] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][268] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][269] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][270] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][271] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][272] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][273] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][274] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][275] Processing: App\Jobs\SendCampanha
[2018-08-23 18:06:57][276] Processing: App\Jobs\SendCampanha

Now. Is this the right way to do it? If so, what I am doing wrong, or not doing to make it work? Any helps? Hints?

Thanks in advance!

0 likes
7 replies
aurawindsurfing's avatar
Level 50

Hi @marcellopato ,

One very important thing about sending it that way. You expose your server and IP to being potentially blacklisted if some people will mark it as a spam. I'm speaking from my own experience. It is so much easier to use one of the services that provide you with templating and e-mail scheduling and delivery like mailchimp, sendinblue, sendgrid etc.

They have one super feature - they let you buy an IP. One something goes wrong along the way all you need to do it to buy new IP. There is a good reason people do not send campaigns from own servers.

Correct me if I'm wrong but that is my impression. My list is not so big, about 150k emails and I already have hit that roadblock.

Hope it helps!

1 like
Mubsira's avatar

I recently used MailGet Bolt for my email marketing campaign. And I must say that is very easy to use, has a simple interface along with having a very important feature of testing your connected SMTP, by sending test emails. Also, they have a list cleaning feature that can be easily integrated into MailGet for checking any email lists and protecting against any spam users.

Have a look at it here: https://www.formget.com/best-email-marketing-services/

donal1984's avatar

I will suggest two different email service provider with their different email services Bulk Email Marketing Services, we provide email newsletters, email drip campaigns, automated welcome emails, email template design, copywriting, transactional emails. 1 https://mailcot.com/

2 https://migomail.com/

Please or to participate in this conversation.