0

How to send Email in octobercms after form submission? i created a mail from backend mail template in octobercms the mail code is contact::form.

// $data has name and email 
        $to = System\Models\MailSettings::get('abc@gmail.com');
        Mail::sendTo($to, 'contact::form', $data);
        return true;

I'm getting this error :

\Components\System\Models\MailSettings' not found

Bhoomi Patel
  • 777
  • 10
  • 32
rameez.hashmi
  • 29
  • 1
  • 12

2 Answers2

0

Not sure what you're using MailSettings::get('abc@gmail.com') for, but you can remove that line and simply pass in the email address:

Mail::sendTo('abc@gmail.com', 'contact::form', $data);
Joseph Oppegaard
  • 611
  • 5
  • 12
0

Did you configure the mail system correctly to send mail?

enter image description here

What do you need the mail settings info for? Remove that line. I believe that email will automatically be used unless you specify it in the Mail function.

I believe you need to add the Mail class (maybe input) to your component like so:

use Mail;
use Input;

enter image description here

Pettis Brandon
  • 875
  • 1
  • 6
  • 8