Hallo iedereen,

Ik ben geswitched van versio naar strato.
Nu is mijn probleem dat dit formulier geen emails meer vertuurd met de Gmail die ik gebruikte.
Verschillende pagina's bekeken in google en zou het probleem zijn dat hij niet automatisch meer verstuurd vanaf php.ini.

nu heb ik daar alles smtp en dergelijken ingevoerd maar dat werkt nogsteeds niet.

Kan iemand mij helpen deze form naar SMTP te maken implaats van native phpmail.

bij voorbaad dank.


$mail = new PHPMailerLite();
$mail->IsMail(); // telling the class to use native PHP mail()
$mail->IsHTML(); // telling the class to use html

//$scaling = round(($detailscropped[0]*$detailscropped[1])/($details[0]*$details[1]),2);
$scaling = round(($details[1]*$ratio) / ($detailscropped[1]*$ratio),5);

preg_match("/.*?\/([a-z]+)$/", $details['mime'], $matches);
$extension = $matches[1];

$stock = '';
$orignieelFilename = $_POST['original'];


//Get headstrip
$iHeadstrip = $_POST['headstrip'];
$link = mysql_connect( Config::$database_hostname, Config::$database_username, Config::$database_password);
mysql_select_db( Config::$database_dbname, $link);
$queryHeadStrips = mysql_query("select strip FROM headstrips WHERE id = ".$iHeadstrip, $link) or die(mysql_error());
$result = mysql_fetch_row($queryHeadStrips);
$sHeadStrip = $result[0];


if( $_POST['upload'] == 1) {
$afbeelding = "<a href=\"http://basicwalls.nl/" . preg_replace("/\/","",$_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']) . "download.php?file=" . $_POST['cropped'] . "\" target=\"_blank\">Wallpaper." . $extension . "</a><br />\n";
$origineel = "<a href=\"http://basicwalls.nl/" . preg_replace("/\/","",$_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']) . "download.php?file=" . $_POST['original'] . "\" target=\"_blank\">Original." . $extension . "</a><br />\n";
} else {
$afbeelding = "<a href=\"http://" . preg_replace("/step4\.php$/","",$_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']) . "temp/" . $_POST['cropped'] . "\" target=\"_blank\">Wallpaper." . $extension . "</a><br />\n";
$origineel = "<a href=\"http://" . preg_replace("/step4\.php$/","",$_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI']) . $folderOrg . $_POST['original'] . "\" target=\"_blank\">Original." . $extension . "</a><br />\n";
$stock = '[stock]';
}

$iOrderNo = $_POST['orderno'];
$iSpecOrderNo = $_POST['specorderno'];
$sDate = date("d-m-Y");
//$sMySQLDate = date("Y-m-d");
$sName = htmlentities($_POST['naam']);
$sAddress = htmlspecialchars($_POST['adres']);
$sZipcode = htmlspecialchars($_POST['postcode']);
$sCity = htmlspecialchars($_POST['plaats']);
$sCountry = htmlspecialchars($_POST['land']);
$sEmail = htmlspecialchars($_POST['email']);
$iPhone = htmlspecialchars($_POST['telefoon']);
$iHeight = htmlspecialchars($_POST['height']);
$iWidth = htmlspecialchars($_POST['width']);
$iComment = htmlspecialchars($_POST['comment']);
$iFinishing = htmlspecialchars($_POST['finishing']);
$iMaterial = htmlspecialchars($_POST['material']);
$iServerid = htmlspecialchars($_POST['serverID']);

//$iPriceperm2 = htmlspecialchars($_POST['priceperm2']);
$iStrips = round(floatval($_POST['width'])/46.50,2);
$iSurface = round(floatval($_POST['width'])*floatval($_POST['height']),2);
$iUserId = $_SESSION['userid'];
$sCroppedImage = $_POST['cropped'];
$sOriginalImage = $_POST['original'];
$sReferenceClient = $_POST['specorderno'];
$sImgSrc = $_POST['imgsrc'];

//Get price
$query = mysql_query("select price,company,company_id,email,name,address,zipcode,city,country,phone FROM users WHERE id = ".$_SESSION['userid'], $link) or die(mysql_error());
while($result = mysql_fetch_array($query)){
$iPriceperm2 = $result['price'];
$sCompany = $result['company'];
//$sCompanyId = $result['company_id'];
$sCompanyId = 17;
$sUserEmail = $result['email'];
$uName = $result['name'];
$uAddress = $result['address'];
$uZipcode = $result['zipcode'];
$uCity = $result['city'];
$uCountry = $result['country'];
$uPhone = $result['phone'];
}

//Calculate price
$banen = ceil($_POST['width'] / 46.50);
$hoogte = $iHeight / 100;
$labelhoogte = 0.1;
$prijsKlant = $iPriceperm2;
$loopmeters = $hoogte * $banen + $labelhoogte;
$vierkantemeters = $loopmeters /2;
$prijs = round($vierkantemeters * $prijsKlant,2);
$verwerkingskosten = 25.0;
$totaalprijs = $verwerkingskosten+$prijs;


//email translation
$tPreviewEmailText1 .= Config::$PreviewEmailtext_1;
$tPreviewEmailText2 .= Config::$PreviewEmailtext_2;



//If preview then status is 2
if($_POST['preview']==1){
$iStatus = 2;
$previewMessage = "<strong> ************************************************************<br />\n
* !!!!!!!---- " . $tPreviewEmailText1 . " ----!!!!!!!<br />\n
************************************************************<br />\n
" . $tPreviewEmailText2 . "<br />\n
<br />\n
</strong>";
} else {
$iStatus = 0;
}


//Add to DB
$newId = 0;
$sql = "INSERT INTO `orders` (
`orderno`,`date`,`name`,`address`,`zipcode`,`city`,`country`,`email`,`phone`,`height`,`width`,`strips`,`surface`,`sectionimage`,`originalimage`,`headstripid`,`userid`,`priceperm2`,`status`,`ratio`,`x`,`y`,`cropwidth`,`cropheight`,`orgheight`,`orgwidth`,`specorderno`,`comment`,`finishing`,`material`
) values (
'$iOrderNo',NOW(),'$sName','$sAddress','$sZipcode','$sCity','$sCountry','$sEmail','$iPhone','$iHeight','$iWidth','$banen','$iSurface','$sCroppedImage','$sOriginalImage','$iHeadstrip','$iUserId','$iPriceperm2','$iStatus','$ratio','".$_POST['x']."','".$_POST['y']."','".$detailscropped[0]."','".$detailscropped[1]."','".$details[1]."','".$details[0]."','$iSpecOrderNo','$iComment','$iFinishing','$iMaterial'
)";

$query = mysql_query($sql) or die (mysql_error());
if($query){
$newId = mysql_insert_id();
}
htmlspecialchars($_POST['material']);

//email translation
$tTitlebig .= Config::$TitleBig;
$tTitle1 .= htmlspecialchars (Config::$Title_1);
$tTitle2 .= Config::$Title_2;
$tTitle3 .= Config::$Title_3;
$tTitle4 .= Config::$Title_4;
$tReference .= Config::$Yourreference;
$tDate .= Config::$Date;
$tOrdernr .= Config::$OrderNo;
$tName .= Config::$userName;
$tAddress .= Config::$userAddress;
$tPostalcode .= Config::$userPostalcode;
$tCity .= Config::$userCity;
$tCountry .= Config::$userCountry;
$tEmail .= Config::$userEmail;
$tTelephone .= Config::$userTelephone;
$tCompany .= Config::$userCompany;
$tWidth .= Config::$Width;
$tHeight .= Config::$Height;
$tPanels .= Config::$panels;
$tSquaremeters .= Config::$Sqm;
$tAImage .= Config::$linkimg_1;
$tBImage .= Config::$linkimg_2;
$tLabel .= Config::$Label;
$tMaterial .= Config::$Material;
$tFinishing .= Config::$step3Finishing;
$tPreviewEmailText1 .= Config::$PreviewEmailtext_1;
$tPreviewEmailText2 .= Config::$PreviewEmailtext_2;





$body = " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">;
<html xmlns=\"http://www.w3.org/1999/xhtml\">;
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />

<style>

body {
font-size:13px;
font-family:arial, sans-serif;
color: #545454;



}


#Content {
border-color: #d6d6d6;
border: 1px;
border-style: solid;
margin-left: auto;
margin-right: auto;
width: 400px;
height: 100%;
background-color: #ffffff;
padding: 20px;

}


h3 {
color: white;
background-color: #707173;
border-bottom-color: black;
border-bottom: 1px;
border-bottom-style: solid;
height: 39px;
font-size: 14px;
line-height: 36px;
padding-top: 2px;
padding-right: 0px;
padding-bottom: 2px;
padding-left: 10px;
/*background-image: url(images/verloop-grijs.png);*/
background-repeat: repeat-x;
text-transform:uppercase;
width: 99%;
}

</style>

<title>Your wallpaper order</title>


</head>
<body>
<div id=Content>
<img src=\"css/images/logo.png\">
<h1> " . $tTitlebig . " " . $iOrderNo . "</h1>

".
$previewMessage
."

<h3>" . $tTitle1 . "</h3>\n
<p>" . $tDate . " : " . $sDate . "<br />\n
" . $tOrdernr . " : " . $iOrderNo . "<br />\n
</p>
<h3>" . $tTitle2 . "</h3>\n
<p>" . $tCompany . " : " . $sCompany . "<br />\n
" . $tName . " : " . $uName . "<br />\n
" . $tAddress . " : " . $uAddress . "<br />\n
" . $tPostalcode . " : " . $uZipcode . "<br />\n
" . $tCity . " : " . $uCity . "<br />\n
" . $tCountry . " : " . $uCountry . "<br />\n
" . $tTelephone . " nr : " . $uPhone . "<br />\n</p>
<h3>" . $tTitle3 . "</h3>\n
<p>" . $tName . " : " . $sName . "<br />\n
" . $tAddress . " : " . $sAddress . "<br />\n
" . $tPostalcode . " : " . $sZipcode . "<br />\n
" . $tCity . " : " . $sCity . "<br />\n
" . $tCountry . " : " . $sCountry . "<br />\n
" . $tEmail . " : " . $sEmail . "<br />\n
" . $tTelephone . " : " . $iPhone . "<br />\n</p>
\n
<h3>" . $tTitle4 . "</h3>\n
<p>" . $tWidth . " : " . $iWidth . " cm<br />\n
" . $tHeight . " : " . $iHeight . " cm<br />\n
" . $tPanels . " : " . $banen . "<br />\n
" . $tSquaremeters . " : " . $loopmeters . " m2<br />\n
" . $tAImage . " : ". $afbeelding . "
" . $tBImage . " : ". $origineel."
" . $tLabel . " : ". $sHeadStrip."\n<br>
" . $tMaterial . " : ". $iMaterial."\n<br>
</p>
<br>
<img style=\"border-style:solid;border-width:1px;border-color: #db6200;\" src=\"". $sImgSrc ."\"/>
</div>
</body>
</html>
";




$xmldata = "<digitusorder>\n
<serverid>" . $iServerid . "</serverid>\n
<datum>" . date("Y-d-m") . "</datum>\n
<image>". $stock . $orignieelFilename."</image>\n
<dimensions x0=\"" . round($_POST['width']/($detailscropped[0] * $ratio)*$_POST['x'],2) . "\" y0=\"" . round($_POST['height']/($detailscropped[1] * $ratio)*$_POST['y'],2) . "\" />\n
<size w=\"" . $_POST['width'] . "\" h=\"" . $_POST['height'] . "\" />\n
<scaling>" . $scaling . "%</scaling>\n
<headstrip>" . $sHeadStrip . "</headstrip>\n
<ordernr>" . $iOrderNo . "</ordernr>\n
<company>" . $sCompanyId . "</company>\n
<name>" . $_POST['naam'] . "</name>\n
<address>" . $_POST['adres'] . "</address>\n
<zipcode>" . $_POST['postcode'] . "</zipcode>\n
<city>" . $_POST['plaats'] . "</city>\n
<country>" . $_POST['land'] . "</country>\n
<price>" . number_format($totaalprijs, 2, '.', '') . "</price>\n
<specorderno>" .$_POST['specorderno'] ."</specorderno>\n
<comment>".$_POST['comment'] ."</comment>\n
<finishing>".$_POST['finishing'] ."</finishing>\n
<material>".$_POST['material'] ."</material>\n
<croppedimage>" . $_POST['cropped'] . "</croppedimage>\n
</digitusorder>\n";

//If it s a final order
if(!$_POST['preview']==1){
$mail->SetFrom($sUserEmail, $sCompany);
$mail->AddAddress(Config::$email, Config::$naam);
//$mail->AddAddress("[email protected]","Digital Walls");
$mail->Subject = Config::$emailSubject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);

$xmlFilename = $orignieelFilename.".xml";

//$mail->AddAttachment($_POST['original'], "Original." . $extension); // attachment
//$mail->AddAttachment($_POST['cropped'], "Wallpaper.png"); // attachment
$xml = "C:\Windows\Temp/" . md5(serialize($_POST) . serialize($_SERVER));
file_put_contents($xml, $xmldata);
$mail->AddAttachment($xml, $xmlFilename); // attachment
$bSucces = $mail->Send();
@unlink("C:\Windows\Temp/" . $_POST['original']);
}

//Send mail to client
$oClientMail = new PHPMailerLite();
$oClientMail->IsMail();
$oClientMail->IsHTML();
$oClientMail->SetFrom(Config::$email, Config::$naam);
$oClientMail->AddAddress($sUserEmail, $sCompany);
$oClientMail->AddAddress(Config::$email_2);


$oClientMail->Subject = Config::$emailSubject;
$oClientMail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$oClientMail->MsgHTML($body);
$bSucces = $oClientMail->Send();
Wat heb je zelf al geprobeerd ?
En waar liep het toen spaak ?
Welke foutmelding kreeg je ?

Waar heb je de SMTP aanmeldgegevens ingevuld ?

Heb je de handleiding van PHPMailerLite al bekeken ?
Zelf al geprobeerd $mail->IsSMTP(); toe te voegen en gegevens van smtp in te vullen in de php.ini file.

Could not instantiate mail function. Could not instantiate mail function. <- is de melding waar het mee begon.

Probeer overigens met een Gmail te verzenden.
Kan je je code beperken tot relevante code, en deze tussen code-tags plaatsen?
Alvast bedankt!

Reageren