• 15-01-2024, 17:39:56
    #1
    selamlar
    arkadaşlar basit bir smtp form örneği lazım ad - soyad adres telefon gibi bilgileri bana mail atacak yardımcı olursanız çok sevinirim teşekkürler.
  • 15-01-2024, 17:52:25
    #3
    <?php
    use PHPMailer\PHPMailer\PHPMailer;
    require 'PHPMailer/src/Exception.php'; 
    require 'PHPMailer/src/PHPMailer.php';
    require 'PHPMailer/src/SMTP.php';
    $mail = new PHPMailer(true); 
    
    try { 
    $mail->SMTPDebug = 0;
    $mail->isSMTP(); 
    $mail->Host = 'mail.r10.net'; // mail host
    $mail->SMTPAuth = true; 
    $mail->Username = 'info@example.net'; // gönderen kullanıcı adı
    $mail->Password = 'MyStrongPassword!'; // gönderen mail şifre
    $mail->SMTPSecure = 'TLS'; 
    $mail->Port = 587;
    $mail->setFrom('info@example.net'); // gönderen adı
    $mail->addAddress($_POST['mail']);
    
    $mail->Subject = $_POST['subject']; 
    $mail->Body = $_POST['text']; 
    $mail->send();
    } 
    catch (Exception $e) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; }
    ?>
    <form action="testform.php" method="POST">        
    <input type="text" name="mail" class="form-control" placeholder="Email Address">
    <input type="text" name="subject" class="form-control" placeholder="Subject">
    <textarea class="form-control" name="text" rows="3" placeholder="Your Message"></textarea>                
    <button class="btn btn-default" type="submit">Send Message</button>      
    </form>
    PHPMailer kütüphanesini projenize eklemeniz gerekiyor.
  • 15-01-2024, 17:55:45
    #4
    bagbaq adlı üyeden alıntı: mesajı görüntüle
    <?php
    use PHPMailer\PHPMailer\PHPMailer;
    require 'PHPMailer/src/Exception.php'; 
    require 'PHPMailer/src/PHPMailer.php';
    require 'PHPMailer/src/SMTP.php';
    $mail = new PHPMailer(true); 
    
    try { 
    $mail->SMTPDebug = 0;
    $mail->isSMTP(); 
    $mail->Host = 'mail.r10.net'; // mail host
    $mail->SMTPAuth = true; 
    $mail->Username = 'info@example.net'; // gönderen kullanıcı adı
    $mail->Password = 'MyStrongPassword!'; // gönderen mail şifre
    $mail->SMTPSecure = 'TLS'; 
    $mail->Port = 587;
    $mail->setFrom('info@example.net'); // gönderen adı
    $mail->addAddress($_POST['mail']);
    
    $mail->Subject = $_POST['subject']; 
    $mail->Body = $_POST['text']; 
    $mail->send();
    } 
    catch (Exception $e) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; }
    ?>
    <form action="testform.php" method="POST">        
    <input type="text" name="mail" class="form-control" placeholder="Email Address">
    <input type="text" name="subject" class="form-control" placeholder="Subject">
    <textarea class="form-control" name="text" rows="3" placeholder="Your Message"></textarea>                
    <button class="btn btn-default" type="submit">Send Message</button>      
    </form>
    PHPMailer kütüphanesini projenize eklemeniz gerekiyor.
    teşekkürler çok sagol