Привет, я создаю контактную форму с помощью PHPMailer. Но я не могу решить часть этих кодов.SMTP Mail Content
$content = '<div style="background: #eee; padding: 10px; font-size: 14px">'.$message.'</div>';
$mail->MsgHTML($content);
С кодом сообщения $, я получаю только в сообщении своего почтового пользователя. Но я хочу узнать его имя, возраст, электронную почту и т. Д. И я определил их как $ name $ email $ age и т. Д. Но я не могу добавить его в контент. Как я могу это сделать? Извините за мой английский. Благодаря
Мои все документ находится здесь:
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>PHPMailer ile E-posta Gönderimi (DEMO) - Erbilen.NET</title>
<style type="text/css">
* {
padding: 0; margin: 0; list-style: none; border: none; font-family: Arial; font-size: 14px
}
textarea, input {
border: 1px solid #ddd;
border-top-color: #aaa;
border-left-color: #aaa;
padding: 7px;
resize: none
}
input:focus, textarea:focus {
outline: 1px solid #205ec1
}
button {
background: #205ec1;
color: #fff;
padding: 7px 13px;
cursor: pointer
}
form {
width: 400px;
margin: 20px auto;
background: #f9f9f9;
padding: 10px;
border: 1px solid #ddd;
border-top-color: #aaa;
border-left-color: #aaa
}
form h3 {
font-size: 21px;
font-weight: normal;
margin-bottom: 10px;
border-bottom: 1px solid #ddd;
padding-bottom: 10px
}
table tr td {
padding: 6px;
}
.success {
border: 1px solid green;
color: green;
padding: 10px;
margin: 20px auto;
width: 400px
}
.error {
border: 1px solid red;
color: red;
padding: 10px;
margin: 20px auto;
width: 400px
}
</style>
</head>
<body>
<?php
if ($_POST){
$adsoyad = htmlspecialchars(trim($_POST['adsoyad']));
$fakulte = htmlspecialchars(trim($_POST['fakulte']));
$iletisim = htmlspecialchars(trim($_POST['iletisim']));
$eposta = htmlspecialchars(trim($_POST['eposta']));
$istel = htmlspecialchars(trim($_POST['istel']));
$ceptel = htmlspecialchars(trim($_POST['ceptel']));
$iletisim = htmlspecialchars(trim($_POST['iletisim']));
$liste = htmlspecialchars(trim($_POST['liste']));
$digeryayin = htmlspecialchars(trim($_POST['digeryayin']));
$yayinadi = htmlspecialchars(trim($_POST['yayinadi']));
$yazaradi = htmlspecialchars(trim($_POST['yazaradi']));
$yayinevi = htmlspecialchars(trim($_POST['yayinevi']));
$isbn = htmlspecialchars(trim($_POST['isbn']));
$gorulme = htmlspecialchars(trim($_POST['gorulme']));
include 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = '[email protected]';
$mail->Password = '-----';
$mail->From = $_POST["eposta"];
$mail->FromName = $_POST["adsoyad"];
$mail->AddAddress('[email protected]'); // Name is optional
$mail->CharSet = 'UTF-8';
$mail->Subject = 'Konu';
$mail->IsHTML(true);
$content = '
<img height="40" width="230" src="varsa logo linki" /><br />
<table>
<tr>
<td>Kullanıcı Adınız:</td>
<td>'.$adsoyad.'</td>
</tr>
<tr>
<td>Güvenlik Kodunuz:</td>
<td>'.$fakulte.'</td>
</tr>
<tr>
<td>İsim Soyisim:</td>
<td>'.$iletisim.'</td>
</tr>
<tr>
<td>Email Adresiniz:</td>
<td>'.$eposta.'</td>
</tr>
</table>';
$mail->MsgHTML($content);
if($mail->Send()) {
// e-posta başarılı ile gönderildi
echo '<div class="success">E-posta başarıyla gönderildi, lütfen kontrol edin.</div>';
} else {
// bir sorun var, sorunu ekrana bastıralım
echo '<div class="error">'.$mail->ErrorInfo.'</div>';
}
}
?>
<form action="" method="post">
<h3>Kullanıcı Bilgileri</h3>
<table>
<tr>
<td width="108">Adınız Soyadınız</td>
<td width="280"><input type="text" name="adsoyad" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>Fakülteniz</td>
<td><input name="fakulte" type="text" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>İletişim Bilgileriniz</td>
<td><textarea name="iletisim" cols="42" rows="4"></textarea></td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type="email" name="eposta" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>İş Telefonu</td>
<td><input type="text" name="istel" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>Cep Telefonu</td>
<td><input type="text" name="ceptel" style="width: 250px; height: 25px" /></td>
</tr>
</table>
</form>
<form action="" method="post">
<h3>Yayın Bilgileri</h3>
<table>
<tr>
<td width="108">Yayın Türü</td>
<td width="280"><select name="liste">
<option value="kitap">Kitap</option>
<option value="dergi">Dergi</option>
<option value="seskasedi">Ses Kasedi</option>
<option value="videokasedi">Video Kasedi</option>
<option value="vcd">VCD</option>
<option value="dvd">DVD</option>
<option value="cd">CD</option>
<option value="disket">Disket</option>
</select>
<input type="text" name="digeryayin" value="Diğer (Belirtiniz)" style="width: 250px; height: 25px; margin-top: 5px" />
</td>
</tr>
<tr>
<td>Yayın Adı</td>
<td><input type="text" name="yayinadi" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>Yazar Adı & Soyadı</td>
<td><input type="text" name="yazaradi" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>Yayınevi</td>
<td><input type="text" name="yayinevi" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>ISBN-ISSN</td>
<td><input type="text" name="isbn" style="width: 250px; height: 25px" /></td>
</tr>
<tr>
<td>Yayını Nerede Gördünüz?</td>
<td><textarea name="gorulme" cols="42" rows="4"></textarea></td>
</tr>
<tr>
<td></td>
<td><button type="submit">Gönder</button></td>
</tr>
</table>
</form>
</body>
</html>
И что я должен писать вместо $ message. ?
$content = ''.$message.' ';
– KatzenliebeВы можете установить 'Body' напрямую, но' msgHTML() 'делает это, а также несколько других вещей, поэтому это не ответ. – Synchro