Contact form not working

5 replies · opened Apr 17, 2021

JJunichiMatsuuraApr 17, 2021

I set my email address up to receive messages from clients. I followed the documentation of canvas but it didn't work. Things I did are below. I changed email and name from default to mine.

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

$toemails = array();

$toemails[] = array(
'email' => 'junichimatsuura0220@gmail.com', // Your Email Address
'name' => 'Junichi' // Your Name
);

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

$fromemail = array(
'email' => 'junichimatsuura0220@gmail.com', // Company's Email Address (preferably currently used Domain Name)
'name' => 'junichi' // Company Name
);

SSemicolon WebSTAFFApr 17, 2021

Hello,

The Codes appear to be fine, however, it appears that your Server is blocking SMTP Connections if you are not receiving any emails. Additionally, upon testing your Website and the Contact Form, it is giving us a Message Successfully Sent message but we are not sure if your Website is using the SMTP Codes. Please make sure that the codes are updated so that we test properly.

Additionally, since you are using Google SMTP, please make sure that you have already turned on Less Secure App Access in Google Account > Security.

This should definitely work fine. Hope this Helps!

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

JJunichiMatsuuraApr 18, 2021

Thank you for your replay.
I am using xserver and if my server is blocking SMTP Connections, how can I check that? I've done lots of researches but no clue. Additionally, I tested sending messages from my contact form of the Website many times and as you say, I also receive Message Successfully Sent message but no mails on my webmail inbox(sample@junichi0220.xsrv.jp). I set SMTP Codes up following the instruction of canvas setup php Using Gmail SMTP page. I wrote codes like below.

$mail = new PHPMailer();
/* Add your SMTP Codes after this Line */
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "junichimatsuura0220@gmail.com";
$mail->Password = "";
// End of SMTP

I also tried to use xserver SMTP but no works.

$mail = new PHPMailer();
/* Add your SMTP Codes after this Line */
$mail->IsSMTP();
$mail->Host = "sv12233.xserver.jp";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Port = 26;
$mail->Username = "sample@junichi0220.xsrv.jp";
$mail->Password = "";
// End of SMTP

I also turned on Less Secure App Access in Google Account > Security. but not working.
I tried not to use Gmail and use xserver's webmail(sample@junichi0220.xsrv.jp) and connecting sample@junichi0220.xsrv.jp with junichimatsuura0220@gmail.com following the setting of account and import on gmail. then I wrote coding like below.

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

$toemails = array();

$toemails[] = array(
'email' => 'sample@junichi0220.xsrv.jp', // Your Email Address
'name' => 'Junichi' // Your Name
);

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

$fromemail = array(
'email' => 'sample@junichi0220.xsrv.jp', // Company's Email Address (preferably currently used Domain Name)
'name' => 'Junichi' // Company Name
);

This also didn't work. I really hope there's some kind of solutions. I am looking forward to hearing your replay.

SSemicolon WebSTAFFApr 18, 2021

Hello,

This is most likely an issue with the Server Configurations as the Server you are using appears to be blocking SMTP or not sending Emails through the PHP mail() function. According to the codes you have posted above, it looks perfectly fine and should work without any issues. The first thing you can do is contact your Hosting Provider and provide them with these details along with asking them to troubleshoot this issue for you. If something is blocked they should be able to unblock it or provide you with an alternative solution. Thanks for your Patience.

Please do let us know if you are still facing any further issues with this.

JJunichiMatsuuraApr 19, 2021

Thank you for your replay.
I contacted the server company(xserver) and got an answer that we checked the mail log with our support, but there was no corresponding record itself. They also said usually, even if the email transmission itself fails for some reason, a record is left in the email log. So, there is a possibility that the email settings themselves on the built program are incorrect. They also said there was no situation where this service restricted SMTP.Additionally, they also mentioned that but is the host name of the server set correctly as "sv12233.xserver.jp"? Is it possible to review the settings on the mail form side once?

The below is my coding and the host name is the same of sv12233.xserver.jp.
/-------------------------------------------------
PHPMailer Initialization
---------------------------------------------------
/

$mail = new PHPMailer();

/* Add your SMTP Codes after this Line */
$mail->IsSMTP();
$mail->Host = "sv12233.xserver.jp";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Port = 26;
$mail->Username = "sample@junichi0220.xsrv.jp";
$mail->Password = "";
// End of SMTP

is there possibility that the file of php.ini(xserver's default file) is not good with the file of form.php?
I changed the number of port from 25 to 26 to be the same of form.php file but didn't work.
The below is a part of codes of the php.ini.

[PHP]
engine = On
default_charset = UTF-8

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
display_errors = On
display_startup_errors = Off

max_execution_time = 180
max_input_time = -1
memory_limit = 1G

allow_url_fopen = On
allow_url_include = Off
file_uploads = On

post_max_size = 1G
upload_max_filesize = 1G

register_argc_argv = Off
short_open_tag = On
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
disable_functions =
disable_classes =
expose_php = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = "EGPCS"
auto_globals_jit = On
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = On
default_socket_timeout = 60

[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i

I really hope you can come up with some solutions. I am looking forward to hearing your replay and thank you for your kind support.

SSemicolon WebSTAFFApr 19, 2021

Hello,

Thanks for the reply. As we have mentioned earlier, this is most likely an issue with the Server Configurations or incorrect configurations are being used for your SMTP Settings. Like this URL: http://sv12233.xserver.jp/ returns an Invalid Message. You must check this with your host and get the proper settings for SMTP including proper Ports. The Codes used are default for most SMTP Servers but some Hosting Services use different ports and authentication methods. This must be verified with your hosting Providers. So the issue is not with the Codes.

Meanwhile, for the Gmail SMTP, you can provide us with your FTP Details and we can try running more checks on this from our side by using our Gmail Settings and see if this is working or not. 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.

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