Php mailler ve Dosya Yükleme

emrykn

Asistan
Katılım
1 Temmuz 2008
Mesajlar
415
Reaksiyon puanı
4
Puanları
18
Merhaba,


Uzun süredir uğraştığım bir sorun bu. Formumda bir adet input file var ve ben burdan maile attachment göndermek istiyorum. Bunu nasıl yapabilirim. Denediğim hiç bir yol olmadı.


<?php






if ($_POST){

$adsoyad = htmlspecialchars(trim($_POST['adsoyad']));
$eposta = htmlspecialchars(trim($_POST['eposta']));
$telefon = htmlspecialchars(trim($_POST['telefon']));
$website = htmlspecialchars(trim($_POST['website']));
$dosyukle = $_FILES[dosyukle];






include 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->Username = 'xxxxxxxxx@gmail.com';
$mail->Password = 'xxxxxxx';
$mail->SetFrom($mail->Username, $adsoyad);
$mail->AddAddress('xxxxxxx@gmail.com', $adsoyad);
$mail->CharSet = 'UTF-8';
$mail->Subject = ' Application From: ' . $adsoyad . ' /' ;
$mail->AddAttachment($_FILES['dosyukle'];
$e_body = "Contacting person is: <strong>$adsoyad </strong> <br> Website: <strong>$website</strong><br> Phone: <strong>$telefon <br>$konum</strong><br> " . PHP_EOL . PHP_EOL;
$e_reply = "<br>You can contact <strong> $adsoyad </strong> via email, $eposta";
$msg = wordwrap( $e_body . $e_reply, 170 );
$content = '<div style="background: #eee ; padding: 10px; font-size: 14px">'.$msg.'</div>';
if($adsoyad == '') {
echo 'Lütfen isminizi Yazın;
} else if(trim($eposta) == ''){
echo 'Lütfen eposta adresinizi yazın';
} else if(trim($telefon) == ''){
echo 'lütfen tel no yazınız.';
} else{
$mail->MsgHTML($content);

}

if($mail->Send()) {

echo 'Mesajınız Ulaştı';
}
}

?>




Bunu nasıl çözebilirim.
 
Üst