Mail problems

4 replies · opened Sep 15, 2018

NNicoBootsSep 15, 2018

I have just published my new web site (www.duepadroni.it). On the index pages for all four languages I have used the contact form which in itself works fine. I receive the messages in my IN-box. The only problem I have is that the form also contains a date range, and this date range is not displayed in the email that I receive. Below is the HTML code for the form that I have used.


                                
    
                                    
    
                                    
                                        Naam *
                                        
                                    
    
                                    
                                        Email *
                                        
                                    
    
                                    
                                        Telefoon
                                        
                                    
    
                                    
                                    
                                     
    
                                    
                                        Onderwerp *
                                        
                                    
    
                                    
                                        Betreft
                                        
                                            -- Maak uw keuze --
                                            Algemeen
                                            Appartement Loggione
                                            Appartement Cantinetta
                                      	
                                    
                                    
                                    	
                                      
                                        periode
                                        
                                          van
                                          
                                          tot
                                          
                                        
                                      
                                    
    
                                    
    
                                    
                                        Bericht *
                                        
                                    
    
                                    
                                        
                                    
    
                                    
    
                                        
                                        
    
                                    
    
                                    
                                        Verstuur bericht
                                    
    
                                

I have also made some changes to the seandmail.php file as instructed in the manual:

if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
	if( $_POST['template-contactform-email'] != '' ) {

		$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';
		$email = isset( $_POST['template-contactform-email'] ) ? $_POST['template-contactform-email'] : '';
		$phone = isset( $_POST['template-contactform-phone'] ) ? $_POST['template-contactform-phone'] : '';
		$service = isset( $_POST['template-contactform-service'] ) ? $_POST['template-contactform-service'] : '';
		$van = isset( $_POST['template-contactform-van'] ) ? $_POST['template-contactform-van'] : '';
		$tot = isset( $_POST['template-contactform-tot'] ) ? $_POST['template-contactform-tot'] : '';
		
		$daterange = isset( $_POST['template-contactform-daterange'] ) ? $_POST['template-contactform-name'] : '';
		$subject = isset( $_POST['template-contactform-subject'] ) ? $_POST['template-contactform-subject'] : '';
		$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';

		$subject = isset($subject) ? $subject : 'New Message From Contact Form';

		$botcheck = $_POST['template-contactform-botcheck'];

		if( $botcheck == '' ) {

			$mail->SetFrom( $email , $name );
			$mail->AddReplyTo( $email , $name );
			foreach( $toemails as $toemail ) {
				$mail->AddAddress( $toemail['email'] , $toemail['name'] );
			}
			$mail->Subject = $subject;

			$name = isset($name) ? "Name: $name

" : '';
			$email = isset($email) ? "Email: $email

" : '';
			$phone = isset($phone) ? "Phone: $phone

" : '';
			$service = isset($service) ? "Service: $service

" : '';
			$van = isset($name) ? "van: $van

" : '';
			$tot = isset($name) ? "tot: $tot

" : '';
			$daterange = isset($newfield) ? "Date Range: $daterange

" : '';
			$message = isset($message) ? "Message: $message

" : '';

			$referrer = $_SERVER['HTTP_REFERER'] ? '

This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';

			$body = "$name $email $phone $service $van $tot $daterange $message $referrer";

The result what I see in my mail is:

Name: nico boots
Email: boots@planet.nl
Phone: 09876543123
Service: Loggione
van:
tot:
Message: testen

As you can see dates are not displayed. Can you tell me how to solve this?

This Form was submitted from: http://www.duepadroni.it/indexIT.php

NNicoBootsSep 19, 2018

knock, knock... somebody home? I appreciate a reply....

SSemicolon WebSTAFFSep 20, 2018

Hello,

We have checked out your Codes and the issue seems to be with the HTML Input Fields which do not include the name Attribute required for the PHP to capture the Values. Make sure your Fields look like this:

This should fix the issue. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

NNicoBootsSep 21, 2018

I have made the changes in the code that you have suggested, but I still do not receive in my mail the dates that I have selected in the date range field. Any suggestion how to solve this?

A second problem which I have not mentioned yet is that the user does not get a message that the form is successfully submitted (or failed). Do I have to adjust the sendmail.php file to achieve this?

SSemicolon WebSTAFFSep 24, 2018

Hello,

We have checked out your Codes Online but we can see that there is no name added to the Form Inputs. Additionally, we can also see that the Default Code Structure of the Forms have not been followed with the .form-process Element not added. Also, we can see that there are several HTML Validation errors on your Page: https://validator.w3.org/nu/?doc=http%3A%2F%2Fwww.duepadroni.it%2FindexIT.php .

Consider fixing the Errors as mentioned above and please let us know again. Additionally, please consider following this article completely: http://support.semicolonweb.com/forums/topic/adding-custom-fields-html-vs-php/#post-2261 .

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard