Kodları lütfen aşağıdaki butonları kullanarak renklendirin. Örnek: <php> echo "Selam Dünya"; </php>
Yardım
karakter kaldı

php ile gönderdiğimin mail gereksize düşmesini nasıl engellerim.

php ile bir kurduğum sistemde toplu mail ya da insanlara tek tek mail gönderiyoruz. gmailde spama düşmemesine rağmen hotmaide düşüyor bunu nasıl engelleyebilirim.
+0
-0
Cevaba KatılıyorumKatılmıyorum
Cevap Yaz Yorum Yaz Arşivime Ekle Takip Et

Doğru Cevap

  • halidaltuner adlı üyenin fotoğrafı
    13 yıl önce yazılmış
    144 cevap - 4 soru
    Gereksiz maillere düşmesini engellemek için öncelikle SMTP Authentication yapmalısınız. Kısaca aşağıdaki gibi bir örnekle bu işlemi gerçekleştirebilirsiniz.
    <?php
    //new function
    
    $to = "post@example.com";
    $nameto = "Who To";
    $from = "post@example.com";
    $namefrom = "Who From";
    $subject = "Hello World Again!";
    $message = "World, Hello!"
    authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);
    ?>
    
    
    <?php
    /* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */
    
    //Authenticate Send - 21st March 2005
    //This will send an email using auth smtp and output a log array
    //logArray - connection,
    
    function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message)
    {
    //SMTP + SERVER DETAILS
    /* * * * CONFIGURATION START * * * */
    $smtpServer = "mail.server.com";
    $port = "25";
    $timeout = "30";
    $username = "smtpusername";
    $password = "smtppassword";
    $localhost = "localhost";
    $newLine = "\r\n";
    /* * * * CONFIGURATION END * * * * */
    
    //Connect to the host on the specified port
    $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
    $smtpResponse = fgets($smtpConnect, 515);
    if(empty($smtpConnect))
    {
    $output = "Failed to connect: $smtpResponse";
    return $output;
    }
    else
    {
    $logArray['connection'] = "Connected: $smtpResponse";
    }
    
    //Request Auth Login
    fputs($smtpConnect,"AUTH LOGIN" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authrequest'] = "$smtpResponse";
    
    //Send username
    fputs($smtpConnect, base64_encode($username) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authusername'] = "$smtpResponse";
    
    //Send password
    fputs($smtpConnect, base64_encode($password) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authpassword'] = "$smtpResponse";
    
    //Say Hello to SMTP
    fputs($smtpConnect, "HELO $localhost" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['heloresponse'] = "$smtpResponse";
    
    //Email From
    fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailfromresponse'] = "$smtpResponse";
    
    //Email To
    fputs($smtpConnect, "RCPT TO: $to" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailtoresponse'] = "$smtpResponse";
    
    //The Email
    fputs($smtpConnect, "DATA" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data1response'] = "$smtpResponse";
    
    //Construct Headers
    $headers = "MIME-Version: 1.0" . $newLine;
    $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
    $headers .= "To: $nameto <$to>" . $newLine;
    $headers .= "From: $namefrom <$from>" . $newLine;
    
    fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n");
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data2response'] = "$smtpResponse";
    
    // Say Bye to SMTP
    fputs($smtpConnect,"QUIT" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['quitresponse'] = "$smtpResponse";
    }
    ?>
    
    • alico adlı üyenin fotoğrafı alico
      teşekkürler:) ben farklı bir kodlama kullanmıştım ama bu daha güzel görünüyor.
      13 yıl önce yazılmış
    • Kemal adlı üyenin fotoğrafı Kemal
      Güzel Fonksiyon
      $message = "World, Hello!" burdaki noktalı virgülü unutmayalım =)
      13 yıl önce yazılmış
    • yudu adlı üyenin fotoğrafı yudu
      $mail->SMTPAuth = true;

      selam ben bunu yapıyorum fakat yinede hotmailde gereksize düşüyor ! bu konuda fikri olan varmı ?
      12 yıl önce yazılmış
    • Kemal adlı üyenin fotoğrafı Kemal
      mail gidiyor fakat hala gereksize düşüyorsa domainizin ve kullandığınız ip nin daha önce kullanılıp kara listeye düşmüş olabilme ihtimalini sorgulayın.
      12 yıl önce yazılmış

Cevaplar

Hiç cevap bulunamadı.