Example: Sending Email Using a Remote PHP Web Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Intrigued
    Indigo Rose Customer
    • Dec 2003
    • 6138

    #16
    Originally posted by Corey
    Not bad for free. :yes
    Corey...

    You stated there are lot of free PHP 5 hosting companys. Any you recommend?

    My provider only offers PHP 4.3.0, and I noticed that PHP 5 has several functions that cut down on one's coding (like, file_put_contents).

    If they did not have ADs of any sort that would rock as well... but, I understand if the free offering comes with such ties.

    Thanks in advance,
    Intrigued

    Comment

    • Corey
      Indigo Rose Staff Alumni
      • Aug 2002
      • 9745

      #17
      Hi I don't have any specific names since free hosts come and go so fast but there's a few sites like this which can help you find something quick:

      Comment

      • Intrigued
        Indigo Rose Customer
        • Dec 2003
        • 6138

        #18
        Originally posted by Corey
        Hi I don't have any specific names since free hosts come and go so fast but there's a few sites like this which can help you find something quick:

        http://www.free-webhosts.com/
        I hear you...

        Earlier I spent 20 minutes looking through sites like that one you posted (but not that one in particular, thanks). Some have some zany requirements.

        Intrigued

        Comment

        • Corey
          Indigo Rose Staff Alumni
          • Aug 2002
          • 9745

          #19
          Yeah, I've seen a few whacky ones, "Must be a Guyanese soccer player between 14 and 42 with interests in biology, gourmet cooking, and stilt juggling", etc...

          I know for a fact there are some freebies with PHP5 because I tested some scripts a few months ago that way. Wish I could remember the name but hey, let's face, frankly I'm lucky I manage to find my way to the keyboard each morning, let alone recall something like that. Think "Jim" from the TV show "Taxi".

          Comment

          • longedge
            Indigo Rose Customer
            • Aug 2003
            • 2498

            #20
            Great example that works perfectly using my website. Once again it's an example that immediately starts the cogs whirring and I can think of all sorts of ways to extend this - for starters in a help system to automatically collect system data to append to requests - because users never give you enough detail do they

            I've been asked if I could implement something similar on our lan. I've got access to a server running IIS and I'll install php on there but if I understand things correctly php will have to be able to 'see' an smtp server right? Anybody done this?

            Comment

            • Corey
              Indigo Rose Staff Alumni
              • Aug 2002
              • 9745

              #21
              Hi. I'm not too sure about that, does this link maybe answer that?

              Comment

              • longedge
                Indigo Rose Customer
                • Aug 2003
                • 2498

                #22
                Thanks Corey - seems to doesn't it. I read it as "You don't need access to smtp server so I shall be giving that a try", either way the combination/example is great :yes

                Comment

                • myhq
                  Forum Member
                  • Nov 2004
                  • 2

                  #23
                  Here A New Way

                  $subject = $HTTP_GET_VARS["sb"];
                  $body = $HTTP_GET_VARS["body"];
                  $from = $HTTP_GET_VARS["from"];
                  // specify recipient email address
                  $to="Your E-mail Address";

                  // send our email
                  mail ("$to","$subject","$body","$from");
                  echo "To: " . $to . " |Subject: " . $subject. " |From: " .$from." |Message: " .$body;
                  ?>

                  Save To Any Name With The Extension (.php)

                  Comment

                  • myhq
                    Forum Member
                    • Nov 2004
                    • 2

                    #24
                    Here A New Way

                    First Create Three Label And Name It As Follow
                    From:
                    Subject:
                    Messege:
                    Then Create Three Input
                    Then Create A Button
                    And Set The Text As Submit
                    And Add The Below Script To The Submit Button On The On Click Event


                    -- clear error variable
                    error = 0;

                    -- Get values from input fields
                    from = Input.GetText("Input1");
                    subject = Input.GetText("Input2");
                    body = Input.GetText("Input3");
                    -- Submit To Server
                    tSubmitValues = {
                    sb = subject;
                    body = body;
                    from = from;
                    }

                    -- check for empty fields and deliver errors if needed
                    if String.Length(from) < 1 then
                    Dialog.Message("Error", "Please enter your email address and re-submit. Thank you.");
                    error = 1;
                    end
                    if String.Length(subject) < 1 then
                    Dialog.Message("Error", "Please enter your email subject and re-submit. Thank you.");
                    error = 1;
                    end
                    if String.Length(body) < 1 then
                    Dialog.Message("Error", "Please enter your email message and re-submit. Thank you.");
                    error = 1;
                    end

                    if error~=1 then
                    -- if no errors exist, send the email now and give a confirmation dialog
                    result = HTTP.Submit("http://Your Website Address/Your Script.php", tSubmitValues, SUBMITWEB_GET, 1, Your Port Number, nil, nil);
                    Dialog.Message("Submit Confirmation", "The Following Data You Just Sent Is: \r\n" .. result);
                    Dialog.Message("Thank You", "We Will Get Back To You Shortly\r\n", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
                    Page.Jump("Home");
                    end

                    Comment

                    • travisperkins
                      Forum Member
                      • Feb 2006
                      • 89

                      #25
                      Exampel sends empty email

                      The example given to download in this thread always sends an empty email for me.

                      Yet no one else seems to have had problems with it.

                      Comment

                      • peterruiter
                        Forum Member
                        • Mar 2006
                        • 2

                        #26
                        same problem

                        same problem here.... empty message from my own "to" address

                        Comment

                        • peterruiter
                          Forum Member
                          • Mar 2006
                          • 2

                          #27
                          myhq's way seems to work :P

                          Comment

                          • goukilord10
                            Forum Member
                            • Mar 2005
                            • 130

                            #28
                            Code:
                            myhq's way seems to work :P
                            but i get "nobody" as the email sender
                            and the sender adress i use get wrote inside the mail :(

                            Comment

                            • Ham
                              Forum Member
                              • Apr 2005
                              • 189

                              #29
                              Many thanks for the example Corey:yes

                              Comment

                              • tripc
                                Forum Member
                                • Nov 2006
                                • 8

                                #30
                                if i want its will send the message from 2 input text

                                i cant do (Input.GetText("Input1")); (Input.GetText("Input2"));

                                so how i will do this?

                                for explame:

                                To:
                                Subject:
                                Age:
                                Address:

                                and the message mail will send to me like this:

                                Subject
                                and the message will be(body):
                                Age:
                                Address:
                                Last edited by tripc; 11-18-2006, 04:36 PM.

                                Comment

                                Working...
                                X