CONTACT: SMT Contact Form and Processing

Miva Knowledge Base
Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.
Important Notice: This information is for internal reference only. Use at your own risk.

CONTACT: SMT Contact Form and Processing

Scot Ranney • March 06, 2025


This is based on Scot's Scripts contact form.

Simplified Contact Form: 

This is a simplified version that does not include any honeypot or other stuff like that.

<form action="&mvte:urls:_self:auto;" method="post">
<input type="hidden" name="processcontactform" value="1">

<h4 class="modal-title" id="ContactLabel">Contact Scot's Scripts</h4>

<label for="Name" class="form-label">Full Name</label>
<input class="form-control" id="Name" type="text" name="__name" value="&mvte:global:__name;" placeholder="Name" required>

<label for="Email" class="form-label">Email address</label>
<input type="email" id="email" name="__email" value="&mvte:global:__email;" class="form-control" id="Email1" aria-describedby="emailHelp" placeholder="Your email address">

<label for="emailverify" class="form-label">Verify Email Address</label>
<input class="form-control" id="emailverify" type="email" name="__vemail" value="&mvte:global:__vemail;" placeholder="Type your email address again" required>

<label for="contactMessage" class="form-label">Message: The more detail the better.</label>
<textarea class="form-control" name="__message" id="contactMessage" rows="6" required>&mvte:global:__message;</textarea>

<button type="submit" class="btn btn-secondary">Send Message</button>

</form>

Process Contact Form:

<mvt:if expr="NOT g.processcontactform">
	<mvt:exit />
</mvt:if>

<mvt:do file="g.Module_Library_Utilities" name="l.settings:validemail" value="Email_Validate(g.__email)" />

<mvt:if expr="g.__email NE g.__vemail OR NOT l.settings:validemail">
	<mvt:assign name="l.settings:emailerror" value="'There is a problem with your email address or your email addresses do not match.'" />
<mvt:elseif expr="g.__name AND g.__email AND g.__message AND g.__subject">
	<mvt:assign name="l.settings:message_ok" value="1" />
<mvt:else>
	<mvt:assign name="l.settings:emailerror" value="'All fields are required.'" />
</mvt:if>

<mvt:if expr="l.settings:message_ok">
	<mvt:assign name="l.settings:crlf" value="asciichar(13) $ asciichar(10)" />

	<mvt:assign name="l.settings:message" value="encodeentities(g.__name) $ l.settings:crlf $ l.settings:crlf $ 
												 encodeentities(g.__email) $ l.settings:crlf $ l.settings:crlf $ 
												 encodeentities(g.__message) $ l.settings:crlf $l.settings:crlf $ 
												 '------ sender info -----' $ l.settings:crlf $l.settings:crlf $ 
												 'user agent: ' $ s.http_user_agent $ l.settings:crlf $ 
						 'uri path info: ' $ s.request_uri $ l.settings:crlf $
												 'ip: ' $ s.remote_addr " />



	<mvt:assign name="l.settings:fromheader" value="'From: ' $ encodeentities(g.__fname $ ' ' $ g.__lname) $ ' <' $ g.__email $ '>' $ l.settings:crlf" />

	<mvt:if expr="g.__cc">
			<mvt:assign name= "l.settings:ccheader"	 VALUE = "{ 'CC: ' $ ' <' $ l.cc $ '>' $ l.settings:crlf }">
	</mvt:if>

<mvt:comment>
#
# add this date header if you want
<mvt:assign name="l.settings:dateheader"	 value = "{ 'Date: ' $ Format_RFC5322_DateTime() $ l.settings:crlf }">
#
</mvt:comment>

	<mvt:assign name="l.settings:replyheader" value = "'Reply-To: ' $ encodeentities(g.__fname $ ' ' $ g.__lname) $ ' <' $ g.__email $ '>'" />

	<mvt:do file="g.Module_Library_Utilities" name="l.settings:emailsuccess" value="SendEmail(g.store:email, g.__email, '', g.__subject, l.settings:fromheader $ l.settings:ccheader $ l.settings:dateheader $ l.settings:replyheader, l.settings:message)" />

	<mvt:if expr="l.settings:emailsuccess">
		  <mvt:assign name="l.settings:emailsuccess" value="'Thank you for your inquiry. Your message is important to us and we will respond as soon as we can.'" />
	<mvt:else>
		  <mvt:assign name="l.settings:emailerror" value="'There was some kind of system problem, your message was not sent.'" />
	</mvt:if>
</mvt:if>

<mvt:if expr="l.settings:emailspam OR l.settings:emailsuccess">
	<mvt:assign name="g.__fname" value="''" />
	<mvt:assign name="g.__lname" value="''" />
	<mvt:assign name="g.__email" value="''" />
	<mvt:assign name="g.__vemail" value="''" />
	<mvt:assign name="g.__message" value="''" />
</mvt:if>

https://www.scotsscripts.com/mvblog/contact-smt-contact-form-and-processing.html

mvkb_email mvkb_contact