• 08-08-2016, 11:08:02
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Merhaba arkadaşlar smpt mail kullanıyorum kullandığım form ve komutlar aşağıda bu forma dosya ekleme özelliğini nasıl ekleyebilirim.

    <div class="iletisimkutusu">      
                            
                            
                            <meta charset="utf-8"/>
    <form method="post">
      <input type="text" onfocus="this.placeholder = ''" placeholder="İsim" name="ad"/><br/>
     <input type="text" onfocus="this.placeholder = ''" placeholder="Konu" name="konu"/><br/>
     <input type="text" onfocus="this.placeholder = ''" placeholder="E Posta Adresiniz" name="eposta"/><br/>
    <input type="text" onfocus="this.placeholder = ''" placeholder="Telefon Numaranız" name="telefon"/><br/>
     <textarea placeholder="Konu" onfocus="this.placeholder = ''" name="mesaj"/></textarea><br/>
                          <button type="subimt" value="GÖNDER">GÖNDER</button>
    </form>
    <?php
    if(isset($_POST['ad']) && isset($_POST['eposta']) && isset($_POST['konu']) && isset($_POST['mesaj'])) {
        function epostakontrol($email){if (filter_var($email, FILTER_VALIDATE_EMAIL)){return 1;} else {return 0;}} 
        $gelen_mail = $_POST['eposta']; $mail_kontol=epostakontrol($gelen_mail);
    
       if(empty($_POST['ad']) || empty($_POST['eposta']) || empty($_POST['konu']) || empty($_POST['mesaj'])) {
          echo 'Lütfen boş yer bırakmayın.';
       } else if($mail_kontol == "0"){echo 'Lütfen e-posta adresini doğru girin.';} else{
          include 'class.phpmailer.php';
                $mail = new PHPMailer();
                $mail->IsSMTP();
                $mail->SMTPAuth = true;
                $mail->Host = 'localhost';
                $mail->Port = 25;
                $mail->Username = 'mailadresim';
                $mail->Password = 'sifreburaya';
                $mail->SetFrom($mail->Username, $_POST['ad']);
                $mail->AddAddress('mailadresim', 'İsim Soyisim');
                $mail->CharSet = 'UTF-8';
                $mail->Subject = $_POST["konu"];
                $mail->MsgHTML('İsim:'.$_POST["ad"].'<br/>
                                Konu:'.$_POST["konu"].'<br/>
                                E-Posta:'.$_POST["eposta"].'<br/>
                                Telefon:'.$_POST["telefon"].'<br/>
                                Mesaj:'.$_POST["mesaj"].'<br/>');
    if($mail->Send()) { echo 'Mesajınız başarıyla gönderildi.';} 
    else { echo 'Mesaj gönderirken bir hata oluştu ve girmiş olduğunuz bilgiler alınamadı.' . $mail->ErrorInfo;}
       }}
    ?>     
                  
                        </div>
  • 08-08-2016, 11:10:11
    #2
    $mail->AddAttachment('dosya.zip');

    Bu kodu kullanarak gönderim yapabilirsiniz.
  • 08-08-2016, 11:33:43
    #3
    MehmetIZMRLG adlı üyeden alıntı: mesajı görüntüle
    $mail->AddAttachment('dosya.zip');

    Bu kodu kullanarak gönderim yapabilirsiniz.
    teşekkürler, peki bu kodu nereye ekleyeceğim birde html form kısmına nasıl bir kod ekleyeceğim
  • 08-08-2016, 11:55:57
    #4
    <div class="iletisimkutusu">


    <meta charset="utf-8"/>
    <form method="post">
    <input type="text" onfocus="this.placeholder = ''" placeholder="İsim" name="ad"/><br/>
    <input type="text" onfocus="this.placeholder = ''" placeholder="Konu" name="konu"/><br/>
    <input type="text" onfocus="this.placeholder = ''" placeholder="E Posta Adresiniz" name="eposta"/><br/>
    <input type="text" onfocus="this.placeholder = ''" placeholder="Telefon Numaranız" name="telefon"/><br/>
    <input type="text" onfocus="this.placeholder = ''" placeholder="Göndereceğiniz Dosya URL" name="dosya"/><br/>
    <textarea placeholder="Konu" onfocus="this.placeholder = ''" name="mesaj"/></textarea><br/>
    <button type="subimt" value="GÖNDER">GÖNDER</button>
    </form>
    <?php
    if(isset($_POST['ad']) && isset($_POST['eposta']) && isset($_POST['konu']) && isset($_POST['mesaj'])) {
    function epostakontrol($email){if (filter_var($email, FILTER_VALIDATE_EMAIL)){return 1;} else {return 0;}}
    $gelen_mail = $_POST['eposta']; $mail_kontol=epostakontrol($gelen_mail);

    if(empty($_POST['ad']) || empty($_POST['eposta']) || empty($_POST['konu']) || empty($_POST['mesaj'])) {
    echo 'Lütfen boş yer bırakmayın.';
    } else if($mail_kontol == "0"){echo 'Lütfen e-posta adresini doğru girin.';} else{
    include 'class.phpmailer.php';
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = 'localhost';
    $mail->Port = 25;
    $mail->Username = 'mailadresim';
    $mail->Password = 'sifreburaya';
    $mail->SetFrom($mail->Username, $_POST['ad']);
    $mail->AddAddress('mailadresim', 'İsim Soyisim');
    $mail->AddAttachment($_POST['dosya']);
    $mail->CharSet = 'UTF-8';
    $mail->Subject = $_POST["konu"];
    $mail->MsgHTML('İsim:'.$_POST["ad"].'<br/>
    Konu:'.$_POST["konu"].'<br/>
    E-Posta:'.$_POST["eposta"].'<br/>
    Telefon:'.$_POST["telefon"].'<br/>
    Mesaj:'.$_POST["mesaj"].'<br/>');
    if($mail->Send()) { echo 'Mesajınız başarıyla gönderildi.';}
    else { echo 'Mesaj gönderirken bir hata oluştu ve girmiş olduğunuz bilgiler alınamadı.' . $mail->ErrorInfo;}
    }}
    ?>

    </div>


    Bu kodlar dosyayı urlden alıp gönderiyor siz şekil verebilirsiniz.

    İşinizi gördüysem eğer r10+ vermeyi unutmayın
  • 09-08-2016, 14:26:57
    #5
    hocam teşekkürler yardımın için ama urlden değil bilgisayardan dosya yükleme işlemini nasıl yapabiliriz
  • 10-08-2016, 11:13:32
    #6
    edit: birde bu forma nasıl güvenlik kodu ekleyebilirim
  • 14-08-2016, 04:10:55
    #7
    else if lere bir de güvenlik kodu şartı ekle.

    Basit bir şey için; https://www.r10.net/showthread.php?p=...post1058459379