We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20014
    • 200 Posts
    modxlearner123 Reply #1, 16 years ago
    ok guys I am doing battle again for another client on 1&1 webhosting, the problem is that one and one requires this code to be placed on the thankyou page for an email to be sent:

    <?php
    $to = '[email protected]';
    $subject = 'subject';
    $message = 'From: ' . $_REQUEST['name'] . "\n\n" . $_REQUEST['data'];
    $email = $_REQUEST['email'];
    $headers = 'From: ' . $email . "\r\n" .
                'Reply-To: ' . $email . "\r\n" .
              'X-Mailer: PHP/' . phpversion();
     
    mail ($to, $subject, $message, $headers);
    header("Location:" . $linkID);



    the solution was to create a snippet and place it on the thankyou page with a link id like this:
    [[mailcode &linkID=`[[~8]]`]]


    now under revo, I still have to do the same thing, but I get all the emails returned,
    I tried taking out the &link and left it the pure snippet code but they are still not being sent, unfortunately I am at a loss since 1&1 insists on the code to send emails.
    the following link explains a bit, but I have always used that code on thank you pages and it has worked, their faq leaves me scratching my head, I assumed another page? http://faq.1and1.com/scripting_languages_supported/php_mail_explained/2.html

    p.s. friendly urls have an extension of html, could that have anything to do with it even though that doesn’t mean they are simple static html docs? i mean are the servers looking for a .php doc only?
      • 20014
      • 200 Posts
      modxlearner123 Reply #2, 16 years ago
      UPDATE

      seems to sometimes work seems sometimes not to when it does two emails are sent: here is the one with the message:
      To: [email protected]
      Subject:
      Date: Sat, 16 Oct 2010 20:59:07 -0400
      From: [email protected]
      
      Hello client's name, here is a message someone sent to you using your email form on your website.
      
      John DOe ([email protected]) Wrote:
      
      
      text of the email is here 


      then immediatly following get this cryptic email:
      > Date: Sat, 16 Oct 2010 20:59:10 -0400
      > To: [email protected]
      > Subject: subject
      > From:
      >
      > From:
      >
      > 


      here is my email form call:
      [[!FormIt? &hooks=`recaptcha,spam,email,redirect` &emailTpl=`email` &emailTo=`[email protected]` &redirectTo=`16`]]
      [[$emailform]]
      the emailform is the form based on the old eform layout, but not code, don’t have problems with this: name, email, regarding dropdown, text field

      and here is the template, it’s basic until I can hash it out,
      Hello Client's Name, here is a message someone sent to you using your email form on your website.
      <br />
      [[+name]] ([[+email]]) Wrote: <br />
       Regarding [[+subject]]<br />
      [[+text]]


      maybe problems populating the subject field? how would I do that, make a call &subject I think we could do that with eform can’t remember

      EDIT: found the answer on populating the subject field &emailSubject=`content here` but does that still explain the email immediately following a successfully sent one?
      the emails arriving are still sporadic.
        • 3749
        • 24,544 Posts
        The email hook in FormIt is sending the mail and the mail() call in your snippet is also sending mail. It should be easy enough to figure out which one is sending the empty message. The two are probably reaching the same instance of the mailer at the same time and may be confusing it with similar fields.

        Personally, I would try using the SMTP System Settings and eliminate the host’s "required" code altogether.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 20014
          • 200 Posts
          modxlearner123 Reply #4, 16 years ago
          thanks bobray, will do, and I agree with you about getting rid of that 1&1 code, it seem rather redundant I am now off to set it up for smtp, as always you’re a lifesaver

          and p.s. there was a thread I had started awhile bag which you were helping me on and I kinda disappeared without reply, the good news is some graphic work and web work came down the pipeline, the bad news is once I can turn my attention back to my own site’s migration to revo I may end up resurrecting that thread from the dead embarrassed

          also is there anyway to sign up for alerts on your book?
            • 20014
            • 200 Posts
            modxlearner123 Reply #5, 16 years ago
            contacted 1&1 HOST about their preferred smtp setup and nothing in their faq other than setting up a desktop client (though I guess I could use that info?) but no reply yet, so I began a series of tests to see which work my first one was using this call:
            [[!FormIt? &hooks=`recaptcha,spam,redirect` &emailSubject=`email from site` &emailTpl=`email`
            
            &redirectTo=`16`]]


            and leaving the 1&1 code in the thankyou page with a link id,

            none were sent back but the only thing to arrive at it’s destination was this:
            > Date: Sun, 17 Oct 2010 12:59:58 -0400
            > To: [email protected]
            > Subject: subject
            > From:
            >
            > From:
            >
            > 

            I added email to the hook but with out the &emailto, and the result was the same.
            still waiting on 1&1
              • 3749
              • 24,544 Posts
              You wouldn’t necessarily need to use their SMTP server. You can use any account you have (e.g., Gmail). That should bypass 1&1 altogether, although I guess it’s possible for them to block SMTP mail.

              If you go to System -> System Settings and put SMTP in the search box, you’ll see the settings and some hints (in the descriptions).

              On the book, don’t worry -- I think you’ll know when it’s available. wink

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 20014
                • 200 Posts
                modxlearner123 Reply #7, 16 years ago
                thanks BobRay, You’re absolutely right, I am going to go the gmail route it never fails and I got the usual from 1&1, go to the faq, the one which explains how to place the code, the same one I posted, my reply was to ask if they even read their emails, that is one host which is a true pain to work with and their server config is horrible, still got to place
                AddType x-mapp-php5 .php
                to the .htaccess...lame >:(

                as for the book, I am hyped!