Email form.php

8 replies · opened Feb 10, 2022

ZzebragrFeb 10, 2022

HI,

I have some trouble with sending emails directly from Canvas... I have added in form.php file my email in the fields to/from & the info about my webserver after "/* Add your SMTP Codes after this Line */":

$mail->IsSMTP();
$mail->Host = "mail.zebra.si";
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;                     
$mail->Username = "webform@zebra.si";
$mail->Password = "*********";
      (pass is correct, only here I've put *******)

I am also using reCapthca3 secret key (also copied in the form.php)

When trying to send I only see the blinkng circle in the middle of the page (looks like something is going to happen...), but it blinks all the time and there are no emails sent... (attached picture) They are not even formed as I cannot see them in Drafts or Sent folder if I check email.

I have seen further down in "include" folder a subfolder named "phpmailer", am I supposed to change/amend files in this subfolder as well?

Thanks & regards, David

ZzebragrFeb 10, 2022

Forgot to tell you that server has "SMTPDebug" turned on and should display the error right away (if any), but it doesn't, so I am afraid the form.php is not forming the email to be sent.

ZzebragrFeb 10, 2022

Another thing... what is the preferred attribute for "form.php" file on the server? Now it is 644, so execution is not allowed (picture)

SSemicolon WebSTAFFFeb 10, 2022

Hello,

Consider using 775 instead. Additionally, please consider adding the .customjs Class to the .form-widget DIV in the HTML Codes and then following code at the very top of your include/form.php File after the opening php tags:
[ch_pre type="php"]error_reporting(E_ALL);[/ch_pre]

which should display all the possible errors. Please notify us about the Error Message you see, after going through the process above, so that we can provide you with more assistance on this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

ZzebragrFeb 10, 2022

Ok, form.php changed to 755 and added erro reporting code. You mean adding ".customjs Class to the .form-widget DIV in the HTML" like this below:

``

If different, please let me know...

After above implemented, I get the following error:

"2022-02-10 14:00:37 SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
{ "alert": "error", "message": "Email could not be sent due to some Unexpected Error. Please Try Again later.

Reason:
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting" }"

SSemicolon WebSTAFFFeb 10, 2022

Hello,

Yes, the steps you have used above is absolutely correct.

So, according to the Error Message, this is a Server Configuration Issue and not an issue with Canvas Codes. You will need to contact your Web Hosting Provider with this error message and get the correct SMTP Ports and endpoints for a successful SMTP connection.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

ZzebragrFeb 10, 2022

Ok, solved, apparently parameter "$mail->IsSMTP();" should be replaced with "$mail->isMail();" and now it works... So you can put this as RESOLVED.

I do have a question connected to this... I have added reCaptcha as instructed, but how do I know it is "implemented"? It supposed to work "under the hood", but does it?

ZzebragrFeb 10, 2022

Ok.. another one. I have removed now .customjs class from:

<div class="form-widget customjs">

as I don't want clients to be redirected to a text page that says:

Sending with mail()
Sendmail path: /usr/sbin/sendmail -t -i
Envelope sender: webform@zebra.si
To: David <zebra.graphic@gmail.com>
Subject: Test email web gmail
Headers: Date: Thu, 10 Feb 2022 19:44:47 +0100From: "Zebra Graphic d.o.o." <webform@zebra.si>Message-ID: <o2uVIYnMd9YJ3yXxex4A1rWgVZsW7PdSUKFmfYOo@www.zebra.si>X-Priority: 1X-Mailer: PHPMailer 6.5.0 (https://github.com/PHPMailer/PHPMailer)MIME-Version: 1.0Content-Type: multipart/alternative; boundary="b1_o2uVIYnMd9YJ3yXxex4A1rWgVZsW7PdSUKFmfYOo"Content-Transfer-Encoding: 8bit
Additional params: -fwebform@zebra.si
Result: true
{ "alert": "success", "message": "We have successfully received your Message and will get Back to you as soon as possible." }

And I do receive email, but the user does not get confirmation that email has been sent, as only blinking circle stays on the page like it is sending (doesn't go away or inform that email has been sent... like the one seen above on the text only page - "We have successfully received your Message and will get Back to you as soon as possible.")

Any solution for that? Regards, David

SSemicolon WebSTAFFFeb 11, 2022

Hello,

  1. For using reCaptcha v3, we recommend using the Codes from the contact-recaptcha-v3.html Template. And yes, it does work fine.

  2. Simply set the $mail->SMTPDebug = 0;.

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard