Skip to content

Examples ​

Full example ​

Form ​

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

{!-- ReCaptcha support --}
{exp:reinos_email_form:init_recaptcha}

{exp:reinos_email_form:form
	required_fields="name|emailaddress"
}

    <div class="container">
        <div class="row">
            <div class="col">
                <div class="form-group">
                    <label for="name">Name</label>
                    {name:error}
                    <input type="text" class="form-control" id="name" placeholder="Your name" value="{name:value}" name="name">
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col">
                <div class="form-group">
                    <label for="emailaddress">Email address</label>
                    {emailaddress:error}
                    <input type="email" class="form-control" id="emailaddress" placeholder="name@example.com" value="{emailaddress:value}" name="emailaddress">
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col">
                <div class="form-group">
                    <label for="message">Message</label>
                    {message:error}
                    <textarea class="form-control" id="message" rows="3" name="message">{message:value}</textarea>
                </div>
            </div>
        </div>
        <div class="row">
             <div class="col">
                 <div class="form-group">
                     <label for="name">Hobbies</label>
                     <input name="hobbies[]" type="checkbox" value="football"/>
                     <input name="hobbies[]" type="checkbox" value="hockey"/>
                     <input name="hobbies[]" type="checkbox" value="chess"/>
                 </div>
             </div>
         </div>
        <div class="row">
            <div class="col">
                {if captcha}
                    <span style="color:red;">{captcha_error}</span><br>
                    {captcha}<br /> 
                    <input type="text" name="captcha" value="" maxlength="20" />
                {/if}
                
                {!-- the captcha (reCAPTCHA or Turnstile) should be enabled in the email_form CP and the tag {exp:reinos_email_form:init_recaptcha} should be added to the head --}
                {if recaptcha}
                    <span style="color:red;">{recaptcha_error}</span><br>
                    {recaptcha}
                {/if}
            </div>
        </div>
        <div class="row">
            <div class="col">
                <button type="submit" class="btn btn-primary">Submit</button>
            </div>
        </div>
    </div>
 
	{email_template
        {!-- a fixed recipient, never an address from the form (see to:field) --}
	   to:name="John Doe"
	   to:email="test@example.nl"
	   from:name="William Doe"
	   from:email="test@no-example.com"
       {!-- reply to the visitor with the name and email entered in the form --}
	   reply_to:name="{name}"
	   reply_to:email="{emailaddress}"
 	   subject="Test email"
	}
		This email is sent to {to:name}, reply to answer {name}.
		The following fields, that are declared inside the form can be used inside this template. 
		
		name: {name}
		email: {emailaddress}
		message: {message}
        Hobbies: {hobbies}
        Hobbies: {hobbies_pair}{value}, {/hobbies_pair} {!-- loop over your data and format the data by yourself --}
	{/email_template}
        
	{email_template
	   to:name="Jane Doe"
	   to:email="sales@example.nl"
	   from:name="William Doe"
	   from:email="test@no-example.com"
	   subject="Test email"
	}
		You can set as many templates as you want.
	{/email_template}

{/exp:reinos_email_form:form}

Direct Email ​

{exp:reinos_email_form:email_template
    direct="yes"
    show_message="yes"
    to:name="John Doe"
    to:email="test@example.nl"
    from:name="William Doe"
    from:email="test@no-example.com"
    subject="Test email"
}
    Everything between the tags is sent by email, just once, and also shown on screen.
    
    Excellent for an invoice. Show the content and send the content once. 
{/exp:reinos_email_form:email_template}

Form with Attachments ​

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

{exp:reinos_email_form:form}
    <div class="alert alert-danger">{attachments_error}</div>

    <div class="container">
        <div class="row">
            <div class="col">
                <div class="form-group">
                    <label for="myfile">File</label>
                    <input type="file" class="form-control" id="myfile" name="myfile">
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col">
                <button type="submit" class="btn btn-primary">Submit</button>
            </div>
        </div>
    </div>
 
	{email_template
	   to:name="John Doe"
	   to:email="test@example.nl"
	   from:name="William Doe"
	   from:email="test@no-example.com"
 	   subject="Test email"
 	   attachments="myfile"
	}
		The file is attached as attachment.

        Optionally, set the location for the attachments in the CP.
	{/email_template}

{/exp:reinos_email_form:form}