authenticated smtp

Issues related to forms.
Post Reply
luishmpaulo
 
 
Posts: 133
Joined: Wed Jan 11, 2012 8:49 pm
Location: Brazil
Contact:

authenticated smtp

Post by luishmpaulo »

Hello people.

I put two new sites up, built "as usual", but the contact forms don't send messages to the customer's mailboxes.
Verified and correct emails and passwords.

The host works with authenticated smtp and then in the Advanced settings of form I changed it to SMTP mail engine and other settings according to the host, but the forms still don't send the msgs.

Some time ago I used DBTS to solve problems like this, but it is no longer among the available extensions.

Any tips?

This is the code template that the hosting company gave me:


1st step

Download PHP Mailer by clicking here and select the “PHPMailer_5.2.4.zip” option;



2nd step

Create a file with the extension “.php” (example: formrio.php) with the example code below and extract the file "PHPMailer_5.2.4.zip" in the same directory:



<?php


/* only triggers the form submission if there is $_POST['sendFormulario']*/


if (isset($_POST['sendForm'])){


/*** START - DATA TO BE CHANGED ACCORDING TO YOUR E-MAIL SETTINGS ***/


$enviaFormularioParaName = 'Name of the recipient who will receive the form';

$enviaFormularioParaEmail = 'email-do-recipient@domain';


$MailboxServerName = 'WebSite | Form';

$CaixaPostalServidorEmail = 'user@yourdomain.com.br';

$MailboxServerPassword = 'password';


/*** END - DATA TO BE CHANGED ACCORDING TO YOUR E-MAIL SETTINGS ***/


/* below are the main variables, which must be included in your form*/


$senderName = $_POST['senderName'];

$senderEmail = $_POST['senderEmail'];

$subject = $_POST['subject'];

$message = $_POST['message'];


$mensagemConcatenada = 'Form generated via website'.'<br/>';

$Concatenated message .= '------------------------------<br/><br/>';

$Concatenated message .= 'Name: '.$senderName.'<br/>';

$MensagemConcatenada .= 'Email: '.$senderEmail.'<br/>';

$messagemConcatenada .= 'Subject: '.$subject.'<br/>';

$Concatenated message .= '------------------------------<br/><br/>';

$messagemConcatenada .= 'Message: "'.$message.'"<br/>';

/*********************************** FROM HERE DO NOT CHANGE ********* ***************************/


require ('PHPMailer_5.2.4/class.phpmailer.php');


$mail = new PHPMailer();


$mail->IsSMTP();

$mail->SMTPAuth = true;

$mail->Charset = 'utf8_decode()';

$mail->Host = 'smtp.'.substr(strstr($MailMailServerEmail, '@'), 1);

$mail->Port = '587';

$mail->Username = $MailboxServerEmail;

$mail->Password = $MailboxServerPassword;

$mail->From = $MailMailServerEmail;

$mail->FromName = utf8_decode($MailboxServerName);

$mail->IsHTML(true);

$mail->Subject = utf8_decode($subject);

$mail->Body = utf8_decode($Concatenatedmessage);


$mail->AddAddress($sendFormToEmail,utf8_decode($sendFormToName));


if(!$mail->Send()){

$mensagemRetorno = 'Error sending form: '. print($mail->ErrorInfo);

}else{

$messagemRetorno = 'Form sent successfully!';

}

}

?>


<html lang="en-US">


<head>

<meta charset="utf-8">

<title>Authenticated Sample Form</title>

</head>

<body>


<?php

if(isset($Return message)){

echo $messageReturn;

}


?>

<form method="POST" action="" style="width:300px;">

<input type="text" name="senderName" placeholder="Full name" style="float:left;margin:10px;">

<input type="text" name="SenderEmail" placeholder="Email" style="float:left;margin:10px;">

<input type="text" name="Subject" placeholder="Subject" style="float:left;margin:10px;">

<textarea name="message" placeholder="Message" style="float:left;margin:10px;height:100px;width:200px;"></textarea>

<input type="submit" value="submit" name="submitForm" style="float:left;margin:10px;">

</form>


</body>

</html>

Note: The code used above is just an example.
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: authenticated smtp

Post by BaconFries »

but the contact forms don't send messages to the customer's mailboxes.
See the following url reading from
Emails are not arriving in my inbox...
http://www.wysiwygwebbuilder.com/forum/ ... 10&t=32967
I changed it to SMTP mail engine and other settings according to the host, but the forms still don't send the msgs.
Please contact your host regarding the correct SMTP settings as only they can confirm you are using correctly. Again if emails are not arriving see the above link and read from
Emails are not arriving in my inbox... Please also note there is no help with custom code from your host only they can assist with this.
There is also no need to use the code from your host the forms generated by the software can do this for you is set correctly.
luishmpaulo
 
 
Posts: 133
Joined: Wed Jan 11, 2012 8:49 pm
Location: Brazil
Contact:

Re: authenticated smtp

Post by luishmpaulo »

Thanks!
MGD4me
 
 
Posts: 286
Joined: Tue May 02, 2017 11:56 pm
Location: British Columbia, Canada

Re: authenticated smtp

Post by MGD4me »

As BaconFries recommends, your ISP is the best source for what is needed, depending on how their servers are configured.

Example, if your website is installed on a Shared Host, then the form setting for SMTP Host might be localhost, or it might be the name of your website, or something else. Only your ISP can advise you on that.

In my case, I needed to set SMTP Host to be the name of the website, SSL, and to use port 465.

Good luck
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

I have a similiar problem:

New website with 3 Contact forms each going to a different email address. All 3 forms have the same problem.

I have verified with the Host company that the following Mail Engine settings are correct:
Mail engine: SMTP
SMTP host: smtp.hosts.co.uk
SMTP port: 25
SMTP username: tringu3a.org.uk
SMTP password: S2s8n2**
SMTP encryption: none
Use SMTP Authentication: ticked

Page properties; File extension is set to: php

When I complete and send the form, I am imediately sent to my error page and the form is NOT sent.

If I untick SMTP Authentication - the form works correctly and the form is sent to all CC:s and BCC:s but NOT to the intended Email address.

Link to one of the 3 forms for reference: https://tringu3a.org.uk/contact-us.php

I'm out of ideas -help needed please.
Roy
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: authenticated smtp

Post by Pablo »

Are you sure these are SMTP settings of the host (not of your ISP)?
Did you check the PHP error log on the serve to see why it's not accepted?

If the email is not sent (or received) then it's probably blocked somewhere.

See also the FAQ (Emails are not arriving in my inbox)
viewtopic.php?f=10&t=32967
wwonderfull
 
 
Posts: 1250
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: authenticated smtp

Post by wwonderfull »

roygore wrote: Fri Jan 21, 2022 6:15 pm I have a similiar problem:

New website with 3 Contact forms each going to a different email address. All 3 forms have the same problem.

I have verified with the Host company that the following Mail Engine settings are correct:
Mail engine: SMTP
SMTP host: smtp.hosts.co.uk
SMTP port: 25
SMTP username: tringu3a.org.uk
SMTP password: S2s8n2**
SMTP encryption: none
Use SMTP Authentication: ticked

Page properties; File extension is set to: php

When I complete and send the form, I am immediately sent to my error page and the form is NOT sent.

If I untick SMTP Authentication - the form works correctly and the form is sent to all CC:s and BCC:s but NOT to the intended Email address.

Link to one of the 3 forms for reference: https://tringu3a.org.uk/contact-us.php

I'm out of ideas -help needed please.
Roy
Hello roy,
I think it is completely a server sided issue as I myself faced these problems with some servers. So change it, since then there were no problems receiving the emails. Would recommend you to use another smtp to test it and verify the issue. If you have a demo file you can share it.
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Thanks for the replies.

I would like to upload the web builder files for you to see what I have done and maybe spot something that I've done wrong.

I used to use http://up.labstack.com but it doesn't appear to be available any more. Do you know of a programe that I can use to upload web Builder files for you to access?

Roy
alan_sh
 
 
Posts: 1673
Joined: Tue Jan 01, 2019 5:50 pm

Re: authenticated smtp

Post by alan_sh »

Dropbox? You can create a free account.
User avatar
BaconFries
 
 
Posts: 5316
Joined: Thu Aug 16, 2007 7:32 pm

Re: authenticated smtp

Post by BaconFries »

Probably the easiest way to share your project (.wbs) is to simply upload to your own server then provide a url to download from. You can also use one of the many free public server such as Mediafire and provide the generated url they give.
Note when doing any of this please remove all extensions / custom code you have added this makes it easier to see what may be wrong.
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Thanks Alan and Baconfries for your suggestions.

As I already have a test site which I use to demonstrate things to clients, I have stripped down and put the relevant pages there: https://tringu3a.org.uk/testing/index.html . Go to the Contact Us page for the form.

Although I have already checked with the host provider who confirmed that the Mail Engine setttings are correct, I do think there may still be something not right on the host/server side.

Looking forward to hearing your thoughts and confirmation that nothing is wrong with the form setup.

I really appreciate everyones help.

Roy
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: authenticated smtp

Post by Pablo »

Did you check the PHP error log on the server?
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

I've had a look on my hosting account but can't find an error log to look at.

Any thoughts on where to look?
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: authenticated smtp

Post by Pablo »

The location of the log is different for each web host, so you will need to ask your host.
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Thanks

As today is Sunday, I will contact the host company (who are LCN.com) tomorrow.

Roy
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Hello - I'm back again.

First of all, the hosting company (LCN) does not offer a facility for me to see any error logs through my account.

So, I have spent a lot of time on the phone with the hosting company technical department. They have identified, from the error files, that problem is that the contact form sending email address is invalid - see the following message from them:

The email address that is being used to send emails is not valid for this domain:

roy.gore@rlgconsulting.co.uk

You'll need to ensure that emails are being sent from tringu3a.org.uk as roy@tringu3a.org.uk in order for them to be sent.


I can't find anywhere in the contact form setup to change the sending email address. So, how and where do I change the sending email address? Can this be done by editing the php file?

Your help is greatly appreciated.
Roy
Last edited by roygore on Mon Jan 24, 2022 4:21 pm, edited 1 time in total.
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: authenticated smtp

Post by Pablo »

You can set the 'from' address in the properties of the form.

See also 'Emails are not arriving in my inbox' in my first reply.
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Ah - found it .

Will give this a try.

Thanks
Roy
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Great - that appears to have worked.

I didn't realise that the sending email address could be set in the properties.

Can thank you enough.

Roy
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Still working with the Contact Us form and have read everything I can find about setting the form properties.

I see that by putting an email address in the 'From email' field, that it become the 'From' address when the message is sent. So after receiving the message, the user wants to reply to the message, the 'To' email address is the 'From email' address in the from properties.

It appears from the Help text that the 'Reply to' property can be changed to do various things. Can it be changed to set the reply email to equal the Email Address entered into the form by the user? If yes, what would the code be please?

Roy
User avatar
Pablo
 
Posts: 21508
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: authenticated smtp

Post by Pablo »

If the input field for the email is 'email', then use

Code: Select all

$_POST['email']
User avatar
roygore
 
 
Posts: 140
Joined: Wed Mar 25, 2020 6:34 pm
Location: United Kingdom

Re: authenticated smtp

Post by roygore »

Thanks Pablo for all your help.

Roy
Post Reply