0
votes

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('[email protected]');
        Mail::sendTo($to, 'contact::form', $data);
        return true;

I'm getting this error :

\Components\System\Models\MailSettings' not found

2

2 Answers

0
votes

Not sure what you're using MailSettings::get('[email protected]') for, but you can remove that line and simply pass in the email address:

Mail::sendTo('[email protected]', 'contact::form', $data);
0
votes

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