Exactly what the title implies. I am attempting to send an email after a user submits a form. It may or may not be relevant, but I am using the ekino wordpress/symfony bundle found here. I believe I have narrowed it down to the following line:
$form->handleRequest($request);
If I have this in the code under the createFormBuilder() piece and I click the submit button, I get the following error
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
If I comment that piece out, the form appears to submit but no email ever arrives. Below is the entire function. Thanks for any advice in advance.
public function joinTeamPageAction(Request $request){
$form = $this->createFormBuilder()
->add('from', EmailType::class)
->add('message', TextareaType::class)
->add('send',SubmitType::class)
->getForm()
;
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()){
$data = $form->getData();
$message = \Swift_Message::newInstance()
->setSubject('Join Our Team Request')
->setFrom($data['from'])
->setTo('emailme@example.com')
->setBody(
$data['message'],'text/plain'
)
;
$this->get('mailer')->send($message);
}
return $this->render('/join_team/join_team.html.twig', array("title" => "Join Team","join_team_form" => $form->createView()));
}