Email Code

  Home arrow Email Code arrow URL Mailer
EMAIL CODE

URL Mailer
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-05-05

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    Small snippet from me :) It mailed the URL that you've point on the form field. Have a try :)
    You can have a test in here: http://herm.czechian.net/url_mailer.php

    By : hermawan

    <?php
    /************************************************
    * Snippet Name : URL Mailer *
    * Scripted By : Hermawan Haryanto *
    * Email : hermawan@codewalkers.com *
    * License : GPL (General Public License) *
    ***********************************************/

    if ($_POST) {
    $from_name = htmlentities(trim($_POST["from_name"]), ENT_QUOTES);
    $from_email = htmlentities($_POST["from_email"], ENT_QUOTES);

    if ($from_name != "" && $from_email != "") $from = "$from_name <$from_email>";
    elseif ($from_name == "" && $from_email != "") $from = $from_email;
    else $from = "Anonymous <anonymous@myserver.com>";


    $to_name = htmlentities ($_POST["to_name"], ENT_QUOTES);
    $to_email = htmlentities($_POST["to_email"], ENT_QUOTES);

    if ($to_name != "" && $to_email != "") $to = "$to_name <$to_email>";
    elseif ($to_name == "" && $to_email != "") $to = $to_email;
    else $to = "Hermawan Haryanto <hermawan@codewalkers.com>";

    $url = trim($_POST["url"]);
    if ($url != "") {
    if (allow_url_fopen) {
    $message = file_get_contents ($url);
    } else {
    $message = "Your friend is trying to send you this page: $url \r\n";
    $message.= "But the server is unable to deliver it for you.";
    }
    } else {
    $message = "No HTML to display.";
    }

    $subject = "[URLMailer] ".stripslashes(trim($_POST["subject"]));
    if ($subject == "") $subject = "[URLMailer] No Subject";

    $headers = "MIME-Version: 1.0\r\n";
    $headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers.= "From: $from \r\n";
    @mail ($to, $subject, $message, $headers);
    Header ("Location:".$_SERVER["PHP_SELF"]."?send=done");
    exit();
    }
    if ($_GET["send"] == "done") {
    $str = "<script language=\"JavaScript\">\n";
    $str.= "alert('Email has been sent.!');\n";
    $str.= "</script>\n";
    print $str;
    }
    ?>
    <pre>
    <form method="post">
    To (Name) : <input type="text" name="to_name" width="25">
    To (Email): <input type="text" name="to_email" width="25">
    From (Name) : <input type="text" name="from_name" width="25">
    From (Email): <input type="text" name="from_email" width="25">

    Subject : <input type="text" name="subject" width="25">
    URL : <input type="text" name="url" width="25">
    <input type="submit" name="action" value="SEND">
    </form>
    </pre>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Email Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    EMAIL CODE ARTICLES

    - Basic Ajax contact form
    - Random validation image
    - tinySendMail
    - SaferMail 0.7
    - Smtp Auth Email Script
    - Search Mime Email Structure
    - PHP Text / HTML Email with Attachments 2.1
    - Simple way to send mail wih one attached Doc...
    - Generic POP3 Class
    - PHP Text / HTML Email with Unlimited Attachm...
    - Another SendMail
    - email with attachment
    - Get Email Addresses from Strings
    - EmailCode
    - Email Validation - Gone Wild

    Developer Shed Affiliates

     



    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap