title: Coldfusion send email
body: <p>I have function that checks the form and if the form is fine, it will open a modal notifying the user that there request has been sent(via email). However, I am having a hard time to send the email once the form has been submitted.</p>
  <p>I have the following modal that will appear when the user submits the button:</p>
  <pre><code>&lt;!-- The Modal --&gt;
      &lt;div id=&quot;myModal&quot; class=&quot;modal&quot;&gt;
        &lt;!-- Modal content --&gt;
        &lt;div class=&quot;modal-content&quot;&gt;
          &lt;span class=&quot;close&quot;&gt;&amp;times;&lt;/span&gt;
          &lt;h3 style=&quot;text-align:center; font-family:Verdana, Tahoma, Helvetica, sans-serif; font-size:24px;&quot;&gt;Request Sent&lt;/h3&gt;
          &lt;p style=&quot;text-align:center; font-family:Verdana, Tahoma, Helvetica, sans-serif; font-size:16px; margin-top:28px&quot;&gt;For another request, please click &lt;a id=&quot;marketingHome&quot; href=&quot;marketing.cfm&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  <p>The following code displays the modal:</p>
  <pre><code>    if (reqName.value != &quot;&quot; || email.value != &quot;&quot; || phone.value != &quot;&quot; || mngrName.value != &quot;&quot; ||
         dept.value != &quot;&quot; || reqDate.value != &quot;&quot; || detailed_descrp.value != &quot;&quot; || optns.selectedIndex != 0){
           modal.style.display = &quot;block&quot;;
      }
  </code></pre>
  <p>The following coldfusion code is where I will send an email. The issue I am having is calling the coldfusion code below when the form has been validated and ready to be send. Any help would be appreciated.</p>
  <pre><code>&lt;CFIF isdefined(&quot;form.requestername&quot;)&gt;
              &lt;cfset #requestername# = '#form.requestername#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #requestername# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.email&quot;)&gt;
              &lt;cfset #email# = '#form.email#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #email# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.phone&quot;)&gt;
              &lt;cfset #phone# = '#form.phone#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #phone# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.managername&quot;)&gt;
              &lt;cfset #managername# = '#form.managername#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #managername# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.department&quot;)&gt;
              &lt;cfset #department# = '#form.department#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #department# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.requested_due_date&quot;)&gt;
              &lt;cfset #requested_due_date# = '#form.requested_due_date#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #requested_due_date# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.options&quot;)&gt;
              &lt;cfset #selected_options# = '#form.options#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #selected_options# = ''&gt;
          &lt;/CFIF&gt;
  
          &lt;CFIF isdefined(&quot;form.detailed_description&quot;)&gt;
              &lt;cfset #detailed_description# = '#form.detailed_description#'&gt;
          &lt;cfelse&gt;
              &lt;cfset #detailed_description# = ''&gt;
          &lt;/CFIF&gt;
          
          &lt;!--- Added &quot;#MailFromName#, which displays User Name and CC to CC the Manager. Also the failto. ---&gt;
          &lt;cfmail from=&quot;#mailfrom# (#MailFromName#)&quot; to=&quot;#SendTo#&quot; cc=&quot;#cc#&quot; subject=&quot;MARCOM Form&quot; server=&quot;server&quot; port=&quot;theport#&quot; type=&quot;html&quot; failto=&quot;touser&quot;&gt;
              &lt;html&gt;
                  &lt;head&gt;
                      &lt;style&gt;
                          ##customers {
                              font-family: Arial, Helvetica, sans-serif;
                              border-collapse: collapse;
                              width: 100%;
                          }
  
                          ##customers td, ##customers th {
                              border: 1px solid ##ddd;
                              padding: 8px;
                          }
  
                          ##customers tr:nth-child(even){background-color: ##f2f2f2;}
  
                          ##customers th {
                              padding-top: 12px;
                              padding-bottom: 12px;
                              text-align: left;
                              background-color: ##6297BC;
                              color: white;
                          }
                      &lt;/style&gt;
                  &lt;/head&gt;
                  &lt;body&gt;
                      &lt;cfoutput&gt;
                          &lt;table id=&quot;customers&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
                              &lt;tr&gt;
                                  &lt;th style=&quot;text-align:center&quot; colspan=&quot;2&quot;&gt;Marketing and Communications Job Request Form&lt;/th&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td style=&quot;width:50% !important&quot;&gt;Requestor Name:&lt;/td&gt;
                                  &lt;td&gt;#requestername#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;E-mail Address:&lt;/td&gt;
                                  &lt;td&gt;#email#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;Phone:&lt;/td&gt;
                                  &lt;td&gt;#phone#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;Manager Name:&lt;/td&gt;
                                  &lt;td&gt;#managername#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;Department:&lt;/td&gt;
                                  &lt;td&gt;#department#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;Requested Due Date:&lt;/td&gt;
                                  &lt;td&gt;#requested_due_date#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;Project type:&lt;/td&gt;
                                  &lt;td&gt;#selected_options#&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td style=&quot;vertical-align:top&quot;&gt;Description of the requested job:&lt;/td&gt;
                                  &lt;td&gt;#detailed_description#&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt; 
                      &lt;/cfoutput&gt;
                  &lt;/body&gt;
              &lt;/html&gt;
      &lt;/cfif&gt;
  </code></pre>