Hallo,
habe gerade ein Bestellformular erstellt mit php. Da dieses viele verschiedene Details enthält möchte ich das Mail das versendet wird formatieren.
Wie mache ich das richtige? Wo setze ich das css ein, damit es auch interpretiert wird? Wo "darf" ich die classen und ids eintragen?
Ich habe noch nicht viel in php gemacht und immer nur mit logischen Denken und probieren fertige Scripts angepasst.
Danke, LG
Ruth
habe gerade ein Bestellformular erstellt mit php. Da dieses viele verschiedene Details enthält möchte ich das Mail das versendet wird formatieren.
Wie mache ich das richtige? Wo setze ich das css ein, damit es auch interpretiert wird? Wo "darf" ich die classen und ids eintragen?
Ich habe noch nicht viel in php gemacht und immer nur mit logischen Denken und probieren fertige Scripts angepasst.
PHP:
<?
$fehler ="";
$nz = chr(13);
$who = $_POST['who'];
$customer= $_POST['customer'];
$company = $_POST['company'];
$name= $_POST['name'];
$number= $_POST['number'];
$phone= $_POST['phone'];
$fax= $_POST['fax'];
$mail= $_POST['mail'];
$bill_street= $_POST['bill_street'];
$bill_city= $_POST['bill_city'];
$bill_country= $_POST['bill_country'];
$bill_zip= $_POST['bill_zip'];
$ship_street= $_POST['ship_street'];
$ship_city= $_POST['ship_city'];
$ship_country= $_POST['ship_country'];
$ship_zip= $_POST['ship_zip'];
$units= $_POST['units'];
$article= $_POST['article'];
$note= $_POST['note'];
$message= $_POST['message'];
$pay= $_POST['pay'];
$shipping= $_POST['shipping'];
$what= $_POST['what'];
$condition= $_POST['condition'];
if (empty($who)) $fehler .= "<li>Please, fill if you are a private person or a company. </li>";
if (empty($customer)) $fehler .= "<li>Please, check if you have already ordered from us.</li>";
if (empty($name)) $fehler .= "<li>Please, fill in your name. </li>";
if (empty($phone)) $fehler .= "<li>Please, fill in your phone number. </li>";
if (empty($message)) $fehler .= "<li>Please, tell us how we can help you. The Messagebox is empty. </li>";
if (empty($condition)) $fehler .= "<li>Please, read your conditions and click the box. </li>";
if (empty($fehler)) {
$an = "r.giefing@roithner-laser.com";
$betreff = "Subject: " .$what .", ".$company;
$from = "from Website: " .$what;
$datum = "Datum: ".date("j.n.Y").$nz;
$zeit = "Zeit: ".date("H:i").$nz;
$von = "Von: ".$name."<".$mail.">".$nz;
$bill_adress = "Billing Adress: ".$bill_street .", " .$bill_city .", " .$bill_country .", " .$bill_zip;
$ship_adress = "Shipping Adress: ".$ship_street .", " .$ship_city .", " .$ship_country .", " .$ship_zip;
$personal = "Personal details:" .$nz .$who .", Already customer? ".$customer .", Customer Number: " .$number .$nz ."Company: " .$company .$nz ."Name: " .$name .$nz ."Mail: " .$mail .", Phone: " .$phone .", Fax: " .$fax .$nz .$bill_adress .$nz .$ship_adress;
$order = "Order:" .$units .$article .$note .$nz;
$text = "$datum $zeit $personal $nz Payment: $pay $nz Shipping: $shipping $nz $order Message: $message $nz Order or Request: $what, Condition: $condition";
$titel = "Thank you for your $what. You will get a confirmation within the next days.";
mail($an,$betreff,$text,$from);
} else $titel = "Sorry, but there is a mistake.";
?>
<html>
<style type="text/css">
body {
font-family: Verdana, Georgia, Arial, Helvetica, sans-serif;
font-size: 1em;
text-align:left;
margin-top:50px;}
p { margin-bottom:5px;}
</style>
<head>
<title><?=$titel?></title>
</head>
<body>
<?
if (empty($fehler)) {
$text = strip_tags($text);
$text = htmlentities($text);
$text = str_replace($nz,"<br>",$text);
echo "<p>Thank you for your request/order! You will get a confirmation within the next days.</p>";
echo "<p>$text</p>";
} else {
echo "<p>Sorry, your message could not be send:";
echo "<ul>$fehler</ul>";
echo "</p>";
}
?>
</body>
</html>
Danke, LG
Ruth