Categories
Mailing PHP (also web store pro)
In order to use mail in PHP, authenticated smtp is required just like outlook. To get this done you need to use a bit more code than usual. We have put this code in a file for you so that instead of the mail function you can now use mailTo function. Other than that, this works the same.
To use this function you will need an email address which you can create via the control panel. Remember the password you create with it, you will need this one too. More information can be found here: https://www.mijnhostingpartner.nl/client/knowledgebase/98/Hoe-maak-ik-een-email-adres-aan.html
Click here to download the code
You use this code as follows:
Upload the folder mailer to the wwwroot of your domain.
Then add the following code at the top of the php code from which you want to mail:
$user = "voorbeeld@mijnhostingpartner.nl"; // Enter your own address here
$pass = "example"; // And here the password that goes with it
include("mailer/mhpMail.php"); /* If the php file is not located in the wwwroot but 1 level deeper then add a / in front of it: "/mailer/mhpMail.php" */
?>
Next, the mail function in the php file needs to be changed to mailTo. Otherwise it can be used in the same way.
As for web store pro, there are some files that need to be changed:
index.phpframework/formm
.class.phpframework/newsletter
.class.phpframework/pwishlist
.class.phpframework/simplewishlist
.class.php
Let's start with the index.php. Here you will find quite at the beginning the following 2 lines:
ini_set('display_errors',0);
error_reporting(0);
Immediately below this, the following lines should be added. Modify them as described earlier in this article.
$user = "voorbeeld@mijnhostingpartner.nl";
$pass = "example";
include("mailer/mhpMail.php");
The above lines should also be added to the top of the asinum.php file.
Next, the 2 mail functions within the index.php file should be changed to mailTo. These can be found approximately on line 684, this may vary a bit, but they look like this.
mail($customeremail,$thesubject,$mail,$headers . $headerscustomer);
mail($shopowneremail,$thesubject,$mail,$headers . $headersowner);
So this should be:
mailTo($customeremail,$thesubject,$mail,$headers . $headerscustomer);
mailTo($shopowneremail,$thesubject,$mail,$headers . $headersowner);
Furthermore, on line 977 you will find the following line:
mail($userdata['email'],$thesubject,$mail,$headers);
This then becomes:
mailTo($userdata['email'],$thesubject,$mail,$headers);
The same should be done in the remaining files. The functions can be found for each file on the following lines (so this may vary a bit, but will not be off by much)
File framework/formm.class.php:
line: 42
Framework file/newsletter.class.php: line:
51
File framework/pwishlist.class.php line:
104
File framework/simplewishlist.class.php line:
185
These were the files that need to be changed. Once this is done, sending mail should work properly.