This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

marmelflo8253
marmelflo8253

Hello,

I am new to Laravel and October CMS and I am not the biggest PHP professional. My problem is the validation of a contact form. I understand how to create a contact form and the data-request which referes to a function, which gets the data from the form and sends it, so far. I have an ajax handler for the data request success, which then shows up "Message is sent". But this function does only validate if the data which is sent to the function is correct. I also want to check if the Mail is sent. I did not find the possibility to validate if the server can send the message.

Thank You

Cpt.Meatball
Cpt.Meatball

If I understand correctly this would do the trick:

if(Mail::send('mail.contactform', ...))
{
     //mail success e.g.
    Mail::send('mail.autoresponse', ...)
}else {
    //mail fails , maybe throw exception of some sorts
}

Last updated

VasekS
VasekS

check this: https://stackoverflow.com/questions/29409963/octobercms-post-form/36485700#36485700

                if (count(Mail::failures()) > 0) {
                    echo "Failed to send Mail "; // Handle Failure
                } else {
                    // Mail sent
                    echo "Mail Sent!"; // Handle Success
                }

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.