Jump to content

Php Maile Dosya Ekleme Sorunu


Recommended Posts

natro nun php mail örneği, mail gönderebiliyorum.

 

sorun ise php maile dosya ekleyemiyorum acamiyim :(

 

form.htm ye bunu ekliyorum <input name="gidicekdosya" type="file">

 

mail.php ye nasıl bir ekleme yapıcam yardımcı olabilir misiniz?

 

http://www.natro.com/HemenDestek/Downloads/mailphp.zip

 

 

mail.php

<?
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                   // send via SMTP
$mail->Host     = "mail.aaa.net"; // SMTP servers
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "[email protected]";  // SMTP username
$mail->Password = "aaa"; // SMTP password

$mail->From     = "[email protected]"; // smtp kullanıcı adınız ile aynı olmalı
$mail->Fromname = "site";
$mail->AddAddress("[email protected]","Ornek Isim");
$mail->Subject  =  $_POST['baslik'];
$mail->Body     =  implode("    ",$_POST);

if(!$mail->Send())
{
   echo "Mesaj Gönderilemedi <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Mesaj Gönderildi";


?>
Link to comment
Share on other sites

form.htm dosyasını paylaşabilir misin? Sorun yoksa PHP kodlarını inceleyeceğim.

 

form.htm

<html>

<head>
<meta http-equiv="Content-Language" content="tr">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="mail.php"  method="post" enctype="multipart/form-data">
	<p><font color="#FF0000"><b>Adınız Soyadınız:&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="text" name="isim" size="20"></b></font></p>
	<p><font color="#FF0000"><b>E-mail Adresiniz:&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="text" name="mailad" size="20"></b></font></p>
	<blockquote>
		<p><font color="#FF0000"><b>Konu :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		</b></font>&nbsp;<input type="text" name="baslik" size="20"></p>
	</blockquote>
	<p><b><font color="#FF0000">Mesajınız :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<textarea rows="6" name="mesaj" cols="30"></textarea></font></b></p>

<input name="gidicekdosya" type="file">

<p><input type="submit" value="Gönder"></p>
</form>
</body>

</html>

php kodu sadece mail atıyor dosya ile birlikte gitmesi için attachment kodu eklenmesi lazım diye biliyorum

ama nasıl eklenecek onu bilmemekteyim. 

Link to comment
Share on other sites

yok usta dosya gitmiyor yine mesaj gidiyor ama

<?
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                   // send via SMTP
$mail->Host     = "mail.aaa.com"; // SMTP servers
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "[email protected]";  // SMTP username
$mail->Password = "aaaaaa"; // SMTP password

$mail->From     = "[email protected]"; // smtp kullanıcı adınız ile aynı olmalı
$mail->Fromname = "giden ismi";
$mail->AddAddress("[email protected]","Ornek Isim");
$mail->Subject  =  $_POST['baslik'];
$fileName = $_FILES['gidicekdosya']['name'];
$filePath = $_FILES['gidicekdosya']['tmpname'];
 
$mail->AddAttachment($filePath, $fileName);
$mail->Body     =  implode("    ",$_POST);

if(!$mail->Send())
{
   echo "Mesaj Gönderilemedi <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Mesaj Gönderildi";


?>
Edited by xneverever
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...