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 - Send mail using mail class

  Mail::send(['html' => 'admin.email-template.lowstock'], array('totalUsers' => $totalUsers, 'item' => $item,'data' =>$data), function ($message) use ($user_to_mail, $item) {
                    $message->from('POS@gmail.com', 'POS');
                    $message->subject('Notification Mail');
                    foreach ($user_to_mail as $mail) {
                        $message->to($mail->email);
                    }

                });

            }
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 :: connect to ftp server php 
Php :: public $baseURL codeigniter 4 
Php :: php array if 
Php :: how to create resource in laravel 
Php :: php isset 
Php :: php check if date between two dates 
Php :: laravel permissions package 
Php :: php carbon 
Php :: connect php to db 
Php :: whats the difference between using date function and DATETime in php 
Php :: if one condition 
Php :: get firstwod php 
Php :: default time of session in php 
Php :: latest php version 
Php :: router php 
Php :: Array (key and value) 
Php :: php .com 
Php :: Add Custom Field to woocommerce Subscriptions 
Php :: permission for multisite in wp-config.php file 
Php :: put_assoc 
Php :: @forelse laravel 
Php :: en php comment convertir une date en français stackoverflow 
Php :: codeigniter admin panel with crud generator - 
Php :: Limit number of words to be displayed on blog post excerpt with Laravel 
Php :: laravel create registration bootstrap 
Php :: laravel request 
Php :: How to calculate age using query builder in laravel? 
Php :: php import 
Php :: laravel how to generate short link in laravel framework and relation with 3 model 
Php :: VerifyEmailController in Api 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =