Announcement

Collapse
No announcement yet.

Different email addresses in contact forms?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Different email addresses in contact forms?

    I have two contact forms, one for spare parts and one for vehicles.
    How can I get incoming e-mail from contact form spare parts go to parts@dinhoj.se and vehicles e-mail go to sales@dinhoj.se and not as now all emails go to e-mail address contained in bussiness settings.

    #2
    Several steps are needed:

    1) You would have to add a hidden field ( e.g. FormType set to 'spares' or 'vehicles' ) to each form that indicates which type of form they are. Do not use the email address here as spammers could subvert this.

    2) Patch MailForm.pl to look for the hidden field contents and select the email address to use depending on what's found.

    Look for
    Code:
    		my @Response = ACTINIC::SendMail($::g_sSmtpServer, $$::g_pSetupBlob{EMAIL}, $sSubject, $sTextMailBody, $sEmailRecpt);
    And replace with (NB untested - debug yourself)
    Code:
    		my $FormType = $::g_InputHash{'FormType'};
    		my $emailto = $$::g_pSetupBlob{EMAIL};
    		if ( $FormType eq 'spares' ) 
    			{
    			$emailto = 'parts@dinhoj.se';
    			}
    		elsif ( $FormType eq 'vehicles' ) 
    			{
    			$emailto = 'sales@dinhoj.se';
    			}
    		my @Response = ACTINIC::SendMail($::g_sSmtpServer, $emailto, $sSubject, $sTextMailBody, $sEmailRecpt);
    If the FormType field isn't found the email is sent to the usual address.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Originally posted by NormanRouxel View Post
      Several steps are needed:

      1) You would have to add a hidden field ( e.g. FormType set to 'spares' or 'vehicles' ) to each form that indicates which type of form they are. Do not use the email address here as spammers could subvert this.

      2) Patch MailForm.pl to look for the hidden field contents and select the email address to use depending on what's found.

      Look for
      Code:
      		my @Response = ACTINIC::SendMail($::g_sSmtpServer, $$::g_pSetupBlob{EMAIL}, $sSubject, $sTextMailBody, $sEmailRecpt);
      And replace with (NB untested - debug yourself)
      Code:
      		my $FormType = $::g_InputHash{'FormType'};
      		my $emailto = $$::g_pSetupBlob{EMAIL};
      		if ( $FormType eq 'spares' ) 
      			{
      			$emailto = 'parts@dinhoj.se';
      			}
      		elsif ( $FormType eq 'vehicles' ) 
      			{
      			$emailto = 'sales@dinhoj.se';
      			}
      		my @Response = ACTINIC::SendMail($::g_sSmtpServer, $emailto, $sSubject, $sTextMailBody, $sEmailRecpt);
      If the FormType field isn't found the email is sent to the usual address.
      I need help with code to the hidden field in "Contact Us Bulk Area"

      Comment


        #4
        <input type="hidden" name="FormType" value="spares" />

        Not so difficult to do considering there's already a hidden field there that you could copy and adapt.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Originally posted by NormanRouxel View Post
          <input type="hidden" name="FormType" value="spares" />

          Not so difficult to do considering there's already a hidden field there that you could copy and adapt.
          Thanks Norman.
          Your above code how to send Contact Us e-mail to a custom e-mail address would be included in Advanced Users Guide.

          Comment

          Working...
          X