Page 1 of 2 12 LastLast
Results 1 to 15 of 23

 

Thread: Email software scripts

  1. #1
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Have tried to look but alias not found out


    Is there anyway to have a bit of coding in place to have a multi email option

    Say i have a option for someone to be able to email 8 people from one page

    Can this be done. want to try and keep the harvesters at bay too

    Its a set of parish coucillors emails from me village site.

    Any help would be welcomed


    Thanks

  2. #2
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    2 ways,

    if you use a form that could send the data to a script which sends it on to all 8. Harvesters wouldnt get the emails as they would be in the script. People on the site would just see text forms like when you post a message on here.

    other way would be to set up an email account that then sends it on to whoever. at work we have design @ work.thing and anything sent there gets sent to the design monkeys. but this way is open to email harvesters as they are actually sending an email rather than just filling out a form.
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  3. #3
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts
    cheers mate.

    So even the bog standard scripts aint 100%


    What i would have liked is a drop down menu for emails that once selected would only email that person rather than all.

    Maybe i might have to have 8 pages with a forum built for each or would this still let harvesters get emails

  4. #4
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    oh right you want to do them seperately, I thought you wanted someone to fill in one form and then that go to all the people.

    you can write the email address to the page using javascript which should stop most harvesters:

    <script language="Javascript">
    <!--
    var username = "email";
    var hostname = "somesite.co.uk";
    document.write("<a class=\"whatever\" href=" + "mail" + "to:" + username +
    "@" + hostname + ">Email Us</a>")
    //-->
    </script>

    Or if you have a form you could like you say use a drop down menu, they select Joe Blogs and this sends the value of joe to the form, which then sends it onto an email stored in the form that matches for joe.

    hope that makes sence, if not, I make more understandable answers in the morning
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  5. #5
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yes morleymouse 100 % how I would like to do it.


    Would like to do it as a form but dunno how, think il stick to having separate for now and learn forms

    Thanks again

  6. #6
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    ill post you some stuff up in a bit to get you started, got to have my breakfast first!
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  7. #7
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    okay, here we go some stuff to get you going, this will work as is but you'll want to change it probably...

    html form: (if you have something like dreamweaver these are easy you normally just click a button and it sets up the different fields for you)

    Code:
    <form method="post" action="emailscript.php">
    <p><select name="email">
    <option value="morley">Mr Morley</option>
    <option value="bod">Mr Bod</option>
    </select></p>
    <p><textarea name="emailbody" cols="50"></textarea></p>
    <p><input type="submit" name="Submit" value="Submit"></p>
    </form>
    then you make a file called emailscript.php, basics, just have this in it:

    Code:
    <?
    // the script will receive, from the above form, providing they are filled in:
    // $email which would be either 'morley' or 'bod'
    // $emailbody which is whatever they put in the text field.
    
    // You need to change the email addresses. And when you change the
    // variables that come through the script from the drop down menu
    // you'll need to change the $email == "morley" bits as well.
    
    if ($email == "morley") { $email_address == "my@emailaddress.com"; }
    if ($email == "bod") { $email_address == "you@emailaddress.com"; }
    
    // Set these as you want, the user will go to the thankyou page after,
    // and the default emai laddress is just what the email will come 'from'
    // even though the script is sending it. Helps it get through any
    // spam filters you may have set up.
    
    $website_default_emailaddress == "website@yourstie.com";
    $thankyou_page == "http://www.yoursite.com/thank_you.php";
    
    // simple email headers, again to help it get through spam filters.
    
    $headers="From: Website <$website_default_emailaddress>\nReturn-Path: <$website_default_emailaddress>\r\nTo: $email <$email_address>\r\nReply-To: Website <$website_default_emailaddress>\n";
    
    // Sets up what the user will receive i nthe email, currently it will read:
    // User Entered: (2 line breaks) then whatever was entered i nthe text box.
    
    $emailcontent == "User entered:\n\n".$emailbody;
    
    // PHP mail() function, "email via Website" is the subject.
    
    mail($email_address, "Email via Website", $emailcontent , $headers);
    
    // sends the user to whatever you entered as the thankyou page earlier.
    
    header("Location: $thankyou_page");
    
    ?>
    topics to search on to improve this:
    • PHP mail()
    • html forms
    • php variables
    • php email scripts


    basically by hidding the email address in the script a harvester cannot see it.
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  8. #8
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Many Many Thanks mate.

    Will have a go at this tonight

    Never been called Mr Bod before

  9. #9
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts
    HAve edited the file ti include the emails i need.

    Once you press the button it does go to the script page but nothing happens its just a white screen.

    Im I missing something, ive looked at information about scripts and got lost.

  10. #10
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    probably my sloppy coding, you might need to change all the == to just =

    I dont know why but it sometimes makes a difference, infact, id quite like to know why
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  11. #11
    Registered User

    Status
    Offline
    Join Date
    Mar 2004
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is == for text
    and = for numbers?

    ie.
    == "some text"
    = 5

  12. #12
    mxp
    Registered User

    Status
    Offline
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    double == is used to compare a variable to something and a single = is used to set a variable to something.

    so
    $var=5; sets $var to the value 5 whereas
    $var==5; is asking is $var equal to 5;

    edit:
    You can even have $var===5; which asks whether $var is identical to 5 (but ive never understood how thats any different to equals).
    Last edited by mxp; 13-05-05 at 03:44 PM.

  13. #13
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well Impressed so far.

    Ok the emails now work but they all go to the same person....

    So which ever I choice from the option selecting they also follow the last choice

    And the text doesnt show up..... although can tell the line breaks are working could it be typing in white

  14. #14
    Bod
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Lincolnshire
    Posts
    932
    Thanks
    1
    Thanked 0 Times in 0 Posts
    got the text to show now

  15. #15
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    nah its because you changed the == 's to =

    after just being educated by mxp (ta) there are some that need to be ==

    the first bit wants to be

    if ($email == "morley") { $email_address = "my@emailaddress.com"; }
    if ($email == "bod") { $email_address = "you@emailaddress.com"; }

    other bits...

    $website_default_emailaddress = "website@yourstie.com";
    $thankyou_page = "http://www.yoursite.com/thank_you.php";

    and...

    $emailcontent = "User entered:\n\n".$emailbody;

    then should work, I hope.
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

Page 1 of 2 12 LastLast


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2