Contact Form doesn't complete process

7 replies · opened Nov 15, 2023

RrunnamxNov 15, 2023

Hello,

I've tried making my contact form work with PHP and SMTP, but none have worked.

With PHP, I get the:
Email could not be sent due to some Unexpected Error. Please Try Again later.
Reason:
Could not instantiate mail function.
I read in previous tickets that this could be a server issue, so to then try with SMTP settings, but when I entered the settings in my form.php file, the form just greys out and seems to be loading, but times out after a while and nothing happens.

I've attached screenshots for both instances.

Here is my form code:


						

						

							
								
									
								
							

							
								Name *
								
							

							
								Email *
								
							

							

							
								Phone
								
							

							
								Message *
								
							

							
								
							

							
								Send Message
							

							

						
					

And here is the form.php code:

/*-------------------------------------------------
	PHPMailer Initialization
---------------------------------------------------*/

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';

/*-------------------------------------------------
	Receiver's Email
---------------------------------------------------*/

$toemails = array();

$toemails[] = array(
	'email' => 'hello@yycbestrenos.ca', // Your Email Address
	'name' => 'YYC Best Renos' // Your Name
);

/*-------------------------------------------------
	Sender's Email
---------------------------------------------------*/

$fromemail = array(
	'email' => 'hello@yycbestrenos.ca', // Company's Email Address (preferably currently used Domain Name)
	'name' => 'YYC Best Renos' // Company Name
);

/*-------------------------------------------------
	reCaptcha
---------------------------------------------------*/

// Add this only if you use reCaptcha with your Contact Forms
$recaptcha_secret = ''; // Your reCaptcha Secret

/*-------------------------------------------------
	hCaptcha
---------------------------------------------------*/

// Add this only if you use hCaptcha with your Contact Forms
$hcaptcha_secret = ''; // Your hCaptcha Secret

/*-------------------------------------------------
	PHPMailer Initialization
---------------------------------------------------*/

$mail = new PHPMailer();

/* Add your SMTP Codes after this Line */

$mail->IsSMTP();
$mail->Host = "email.yycbestrenos.ca";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 26;
$mail->Username = "hello@yycbestrenos.ca";
$mail->Password = "*MyPassword*";

// End of SMTP
SSemicolon WebSTAFFNov 17, 2023

Hello,

The Codes look fine but it appears there is some issue with either the Server Configurations or a PHP Error. Would it be possible for you to provide us with FTP Credentials in a private reply, so that we can check this for you and fix it? 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.

RrunnamxNov 17, 2023

Thanks for the reply. I don't have an FTP account yet, do I need to create one and share the credentials? What information do you need?

SSemicolon WebSTAFFNov 21, 2023

Hello,

Thanks for your Kind Patience and Apologies for the Delays in replying to your Support Query!

Its okay if you don't have an FTP. Please provide us with the include/form.php File here so that we can check out the exact issue and provide you with more accurate assistance on this. Then we can guide you further on how to fix this issue. 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.

RrunnamxNov 21, 2023

Thanks, I'm attaching the file below.

SSemicolon WebSTAFFNov 22, 2023

Hello,

Consider trying this code for SMTP:
[ch_pre type="php"]$mail->IsSMTP();
$mail->Host = "smtpout.secureserver.net";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Username = "hello@yycbestrenos.ca";
$mail->Password = "Elefante123!";[/ch_pre]

This should work fine. Hope this Helps!

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

RrunnamxNov 22, 2023

Hello,
Thanks for the suggestion. Could you please make the reply private? I had not realized that the password was shown. I will change it later, but wouldn't like it to be in a public post.
I changed that part of code to the one you provided, but now got a different error message, I'm attaching the image.

SSemicolon WebSTAFFNov 24, 2023

Hello,

Thanks for your Patience!

We have made the Topic Private. This issue appears with the SMTP Host as the Codes included with Canvas do not block the SMTP Connections in any way. Consider getting the proper SMTP Host URL along with Ports and Connection Type from GoDaddy and mention to them that you are using PHPMailer and this issue should be resolved. Please let us know what they so that we can provide you with further assistance based on that.

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