Contact Form doesn't complete process

7 replies·opened Nov 15, 2023
R
runnamxNov 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:

<div class="form-widget mt-5 mx-auto" style="max-width: 750px">

						<div class="form-result"></div>

						<form class="row mb-0" id="template-contactform" name="template-contactform" action="include/form.php" method="post">

							<div class="form-process">
								<div class="css3-spinner">
									<div class="css3-spinner-scaler"></div>
								</div>
							</div>

							<div class="col-md-6 form-group">
								<label class="text-transform-none" for="template-contactform-name">Name <small>*</small></label>
								<input type="text" id="template-contactform-name" name="template-contactform-name" value="" class="form-control required">
							</div>

							<div class="col-md-6 form-group">
								<label class="text-transform-none" for="template-contactform-email">Email <small>*</small></label>
								<input type="email" id="template-contactform-email" name="template-contactform-email" value="" class="required email form-control">
							</div>

							<div class="clear"></div>

							<div class="col-12 form-group">
								<label class="text-transform-none" for="template-contactform-phone">Phone</label>
								<input type="text" id="template-contactform-phone" name="template-contactform-phone" value="" class="form-control">
							</div>

							<div class="col-12 form-group">
								<label class="text-transform-none" for="template-contactform-message">Message <small>*</small></label>
								<textarea class="required form-control" id="template-contactform-message" name="template-contactform-message" rows="6" cols="30"></textarea>
							</div>

							<div class="col-12 form-group d-none">
								<input type="text" id="template-contactform-botcheck" name="template-contactform-botcheck" value="" class="form-control">
							</div>

							<div class="col-12 form-group">
								<button class="button button-rounded button-large m-0" type="submit" id="template-contactform-submit" name="template-contactform-submit" value="submit">Send Message</button>
							</div>

							<input type="hidden" name="prefix" value="template-contactform-">

						</form>
					</div>

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
S
SemiColonWebSTAFFNov 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.

R
runnamxNov 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?

S
SemiColonWebSTAFFNov 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.

R
runnamxNov 21, 2023

Thanks, I'm attaching the file below.

S
SemiColonWebSTAFFNov 22, 2023

Hello,

Consider trying this code for SMTP:

$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!";

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.

R
runnamxNov 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.

S
SemiColonWebSTAFFNov 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