Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter frenil75

    (@frenil75)

    If I add them to classes.php line 728

    $additionaldate = date(DATE_RFC2822);
    		$additionalmid = "<" . sha1(microtime()) . "@" . $_SERVER['HTTP_HOST'] . ">";
    		$headers .= "Date: ". $additionaldate ."\n";
    		$headers .= "Message-ID: ". $additionalmid . "\n";

    it works, but is there a way to set them directly in Additional Header-area instead? (so that the will not be overwritten when upgrading the plugin?

    Thread Starter frenil75

    (@frenil75)

    The web hosting service does not set it automatically and requires them to be set.

    If I run their example, below, I can send mail to external gmail, but not via wordpress and cf7

    <?php
    // Data för mailet
    $sender = "noreply@mywordpressdomain.se";
    $sendername = "My page";
    $recipient = "mygmailadress@gmail.com";
    $recipientname = "My name";
    $subject = "Subject for the mail";
    $message = "mail content";
    
    // Generera datum och mailets id
    $date = date(DATE_RFC2822);
    $mid = "<" . sha1(microtime()) . "@" . $_SERVER['HTTP_HOST'] . ">";
    
    // Ställ in rätt kodningstyp
    mb_internal_encoding("UTF-8");
    
    // Rätt kodning för avsändare och mottagares namn
    $sendername = mb_encode_mimeheader($sendername);
    $recipientname = mb_encode_mimeheader($recipientname);
    
    // Sätt headers
    $headers =<<<EOT
    From: $sendername <$sender>
    Date: $date
    Message-ID: $mid
    MIME-Version: 1.0
    Content-Type: text/plain; charset="UTF-8"
    EOT;
    
    // Skicka mail
    $status = mb_send_mail("$recipientname <$recipient>", $subject, $message, $headers, "-f$sender");
    if(!$status) {
            echo "Mail kunde inte skickas.";
    }
    else {
            echo "Mail skickat!";
    }
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)