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
• 4,560 points
21 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
• 8,620 points

Related Questions In Laravel

0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18 in Laravel by Niroj
• 8,620 points
33 views
0 votes
1 answer

How to pass data through URL and access through controller in Laravel?

Hello, You can  first refer how to  Create controller through ...READ MORE

answered Mar 18 in Laravel by Niroj
• 8,620 points
42 views
0 votes
1 answer

How to identify wheather the request is HTTP GET or HTTP POST in Laravel?

Hey, In order to identify the type of ...READ MORE

answered Mar 19 in Laravel by Niroj
• 8,620 points
22 views
0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19 in Laravel by Niroj
• 8,620 points
26 views
0 votes
0 answers
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
• 4,560 points
38 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
• 8,620 points

edited Jan 21 by Niroj 50 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
• 8,620 points

edited Jan 21 by Niroj 34 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
• 8,620 points
25 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
• 8,620 points
19 views