How to use mail() in laravel?

0 votes
Does Laravel provide API for mail and if yes how to create it in laravel?
Mar 24 in Laravel by kartik
• 27,360 points
85 views

1 answer to this question.

0 votes

Hello,

Laravel provides a powerful and clean API over the SwiftMailer library with drivers for Mailgun, SMTP, Amazon SES, SparkPost, and send an email.With this API, we can send email on a local server as well as the live server.

Here is an example through the mail() 

Laravel allows us to store email messages in our views files. For example, to manage our emails, we can create an email directory within our resources/views directory.

Example:

public function sendEmail(Request $request, $id)
    {
        $user = Admin::find($id);

        Mail::send('emails.reminder', ['user' => $user], function ($m) use ($user) {
            $m->from('info@bestinterviewquestion.com', 'Reminder');

            $m->to($user->email, $user->name)->subject('Your Reminder!');
        });
    }

Thank you!!

answered Mar 24 by Niroj
• 58,960 points

Related Questions In Laravel

0 votes
1 answer

How to use multiple databases in Laravel?

Hello @kartik, Laravel has inbuilt support for multiple ...READ MORE

answered Jul 30 in Laravel by Niroj
• 58,960 points
52 views
0 votes
1 answer

How to pass data to mail View in laravel Mail send?

Hello @kartik, Send data like this. $data = [ ...READ MORE

answered Jul 30 in Laravel by Niroj
• 58,960 points
135 views
0 votes
1 answer

How to use API Routes in Laravel?

Hello @kartik, You call it by http://localhost:8080/api/test ...READ MORE

answered Aug 10 in Laravel by Niroj
• 58,960 points
282 views
0 votes
1 answer

How to only use created_at in Laravel?

Hello @kartik, Eloquent does not provide such functionality ...READ MORE

answered Aug 11 in Laravel by Niroj
• 58,960 points
73 views
0 votes
0 answers

Anyone can help me out to understand the semantic of (document.getElementBYId("demo").innerHTML="Hello") ?

Hello guys, Can Someone helps me to find ...READ MORE

Jan 17 in Web Development by anonymous
• 27,360 points
86 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20 in Web Development by Niroj
• 58,960 points

edited Jan 21 by Niroj 125 views
+1 vote
1 answer

What are pseudo class in css??

Hey, The state of an element is controlled  by ...READ MORE

answered Jan 20 in Web Development by Niroj
• 58,960 points

edited Jan 21 by Niroj 70 views
0 votes
1 answer

How to use Stored Procedures in Laravel?

Hey, To create a Stored Procedure you can ...READ MORE

answered Mar 24 in Laravel by Niroj
• 58,960 points
919 views
0 votes
1 answer

How to make a constant and use globally in laravel?

Hii, You can create a constants.php page in config folder ...READ MORE

answered Mar 24 in Laravel by Niroj
• 58,960 points
94 views