Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel mail send

$arrayEmails = ['someone@mail.com','stranger@mail.com'];
$emailSubject = 'My Subject';
$emailBody = 'Hello, this is my message content.';

Mail::send('emails.normal',
	['msg' => $emailBody],
	function($message) use ($arrayEmails, $emailSubject) {
		$message->to($arrayEmails)
        ->subject($emailSubject);
	}
);
Comment

laravel mail cc

Mail::to($email)
    ->cc(['name1@domain.com','name2@domain.com'])
    ->send(new document());
Comment

laravel mailable from

return (new Mail)
    ->to('hello@example.com')
    ->from('hello@example.com');
Comment

mail laravel

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->from('example@example.com')
                ->markdown('emails.orders.shipped', [
                    'url' => $this->orderUrl,
                ]);
}
Comment

laravel mail

@verbatim
    <div class="container">
        Hello, {{ name }}.
    </div>
@endverbatim
Comment

laravel mail

<?php
 
namespace AppMail;
 
use AppModelsOrder;
use IlluminateBusQueueable;
use IlluminateMailMailable;
use IlluminateQueueSerializesModels;
 
class OrderShipped extends Mailable
{
    use Queueable, SerializesModels;
 
    /**
     * The order instance.
     *
     * @var AppModelsOrder
     */
    protected $order;
 
    /**
     * Create a new message instance.
     *
     * @param  AppModelsOrder  $order
     * @return void
     */
    public function __construct(Order $order)
    {
        $this->order = $order;
    }
 
    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
      	// if only 1 file
        return $this->view('emails.orders.shipped')->attach($this->order['invoice']);
      
      	// if multiple files then i use this code
        return $this->view('emails.orders.shipped');
      	foreach ($this->order['invoice'] as $file){
            $this->attach($file);
        }
    }
}
// Please do comment if you have a better approach
// We all here to find shorter and faster way to get things done
// Thank you
Comment

PREVIOUS NEXT
Code Example
Php :: php array_diff_assoc 
Php :: connect to ftp server php 
Php :: create factory in laravel 8 
Php :: create seed file from db laravel 
Php :: what is isset in php 
Php :: package manifest php error 
Php :: array session 
Php :: move wordpress to new server 
Php :: php remove directory only if empty 
Php :: laravel relations find 
Php :: laravel create command tutorial 
Php :: php array lenght 
Php :: laravel wherein like 
Php :: check box with value in php 
Php :: notification in laravel 8 
Php :: laravel crob job in cpanel 
Php :: different between two dates 
Php :: laravel debugbar not showing 
Php :: palindrom number in php 
Php :: Check Data Load More Laravel Livewire 
Php :: woocommerce coupon notifie a spefic email 
Php :: utf8mb4 decode in php 
Php :: Include Custom Post Types Categories to the main query 
Php :: https://stackoverflow.com/questions/34545641/php-artisan-makeauth-command-is-not-defined 
Php :: 100 rows update php 
Php :: featured image tab not displayed on post 
Php :: wordpress custom post type url not working 
Php :: how to cut middle part of text php 
Php :: laravel add model to polymorphic relationships 
Php :: How can apply_filters be used to create a filter hook in wordpress 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =