Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I understand that, instead of saving the HTML to the server, you want to send it as an e-mail somewhere. It this what you're asking for? If not, please edit/comment your question to clarify what you need.</p> <p>The block </p> <pre><code>if(@$fp = fopen($destination_dir.'index.html', 'w')) { fwrite($fp, $result); fclose($fp); } </code></pre> <p>takes care of writting the file in the server's filesystem, potentially replacing something. If you don't want to save the HTML as a file on the server, you just need to get rid of that block (delete it or comment it out).</p> <p>By that point you already have the generated HTML on the <code>$result</code> variable (if you take a closer look, that's what the original code is saving to the file); so if you want to send it by mail, you already have your body. Figure out the "from", "to", "CC" (if any), and "BCC" (if any) addresses, as well as the subject for your mail. The "from" one often goes as a literal or constant, but may also be an input field from the POSTed form. The "to" address depends on where do you mean to send the mail. Then use something like this for actually mailing it:</p> <pre><code>$to = "here goes the destination address"; $subject = "here you put the subject line for the e-mail"; $headers = "From: " . $whatever_your_sender_address_is . "\r\n" . "MIME-Version: 1.0\r\nContent-type: text/html; charset=utf-8\r\n"; mail($to, $subject, $result, $headers); </code></pre> <p>Take a look at mail()'s documentation on <a href="http://ie2.php.net/manual/en/function.mail.php" rel="nofollow noreferrer">http://ie2.php.net/manual/en/function.mail.php</a> for further details about the mail() function. Note that in this case you'll need to define at least 3 headers: "From" must always be specified (some server-side mail apps may have a default "from" address, but it's always advisable to step on solid ground). The "MIME-Version" and "Content-type" headers are to ensure that the mail is sent as HTML, rather than as text. You might want to add "Reply-to", "CC", "BCC", and other headers, depending on your needs: in such case, just append them to the $headers variable, separated with "\r\n", before the call to mail().</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload