We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    So much to my annoyance - im stuck with 1and1, which 'just' runs the website ive built nicely, however I need to send emails from certain pages - which normally i don't have an issue however on 1and1 this is not the case. they outright block any SMTP (see email below) but advise to use sendmail which for some reason I cannot get working with formit (bobrays quick email snippet runs fine and sends the mails so i must be missing something)

    anyway on to the email:

    Please be informed that sending emails using SMTP via webspace is not supported. Using it directly is risky, as you have to follow SMTP protocol rather perfectly. Otherwise, you fail. And most scripts cannot handle errors -- then vital information like the messages, get lost. So we strongly discourage our customers from using direct SMTP in their scripts. However, there is a perfect substitute for sending messages: the binary /usr/lib/sendmail or in PHP, the function mail().

    So, your script does not follow SMTP closely enough thus we recommend "sendmail" or just PHP::mail().

    Thanks for that help...

    anyhoo,

    can someone please cast their eye over this to just check i'm not missing anything dumb?

    basic call

            
    [[!FormIt?
       &hooks=`email,math,redirect`
       &emailTpl=`ContactForm`
       &emailTo=`email address`
    &redirectTo=`83`
       
    ]]
    
    


    Form Code

    
    [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
     
    <form action="[[~[[*id]]]]" method="post" class="form">
        
        <ul>
        <li class="half">
       
          <span class="error">[[!+fi.error.name]]</span>
        <input type="text" name="name" id="name" value="[[!+fi.name]]" placeholder="Name" />
    
        </li>
    
        <li class="half">
     
        
           <span class="error">[[!+fi.error.email]]</span>
        <input type="text" name="email" id="email" value="[[!+fi.email]]" placeholder="Email"/>
    
        </li>
    
        <li class="half">
    
     
      
          <span class="error">[[!+fi.error.company]]</span>
        <input type="text" name="company" id="company" value="[[!+fi.company]]" placeholder="Company"/>
    
        </li>
    
        <li class="half">
     
    
         <span class="error">[[!+fi.error.tel-no]]</span>
        <input type="text" name="tel-no" id="tel-no" value="[[!+fi.tel-no]]" placeholder="Telephone" />
    
     </li>
    
     <li class="full">
    
    
     <span class="error">[[!+fi.error.math]]</span>
    
    
    <input type="text" name="math" value="[[!+fi.math]]"  placeholder="Solve this equation: [[!+fi.op1]] [[!+fi.operator:is=`-`:then=`minus`:else=`plus`]] [[!+fi.op2]]?"/>
    <input type="hidden" name="op1" value="[[!+fi.op1]]" />
    <input type="hidden" name="op2" value="[[!+fi.op2]]" />
    <input type="hidden" name="operator" value="[[!+fi.operator]]" />
    
    </li>
    
    
        
        <br class="clear" />
     
        <div class="form-buttons">
            <input type="submit" value="Submit Request" />
        </div>
    </form>
    
    
    


    and finally the chunk

    
    [[+name]], [[+company]], [[+email]], [[+tel-no]]
    
    


    Theres nothing to strenous but i just cannot post the email through their servers...

    Any help would be appreciated cos apart from switching hosts im at a blank.

    Cheers

    Tyr
    • Do you have the System Settings set to use SMTP? mail_use_smtp - No.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 30912
        • 463 Posts
        Yeah i do, ive removed all smtp settings
        • Keep in mind that the hooks are processed in the order they are listed. I think you should have the math hook before email, since you want it to run on submission before any mail is sent. Whether or not this will effect the actual sending of the mail I don't know.

          It's also possible that you need to supply more of the &mailOptions properties to have a fully-formed email, otherwise the server may refuse to send it, or the receiving mail server may be rejecting it. http://rtfm.modx.com/extras/revo/formit/formit.hooks/formit.hooks.email#FormIt.Hooks.email-AvailableProperties
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 30912
            • 463 Posts
            Thanks Susan, i'll look at these see if that helps