Jump to content

cocolembo

New Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by cocolembo

  1. 8 minutes ago, gw1500se said:

    Where do you "addAttachement" and reference the uploaded file? I think you did not post your complete code.

    Yes I remove all the php code for the implementation of attachement because it didn't work. I try several times,  So I was wondering where and how I can reference the uploaded file you see in the Html in my "clean" php script who works for sending mail ?  Thank's for your reply

  2. Hello,

    Can someone help me with these contact-form please,

    I just want to include a file (.pdf, .jpg, .png) and send the mail.

     

    For the moment, the mail is send but not with the file included.

     

    Here is the website

    http://www.coeuraprendre.art

     

    HTML CODE :

     

    <form id="contact-form" class="checkform" action="#" target="contact-send.php" method="post" enctype="multipart/form-data" >
    				
    						<div class="form-row clearfix">
    							<label for="name" class="req">Nom *</label>
    							<input type="text" name="name" class="name" id="name" value="" placeholder="Name" />
    						</div>
    						
    						<div class="form-row clearfix">
    							<label for="email" class="req">Email *</label>
    							<input type="text" name="email" class="email" id="email" value="" placeholder="Email"/>
    						</div>
    						
    						<div class="form-row clearfix textbox">
    							<label for="message" class="req">Nom du projet  *</label>
    							<textarea name="message" class="message" id="message" rows="15" cols="50" placeholder="Message"></textarea>
    						</div>
    						
    							<div class="form-row clearfix">
    							<label for="pdf" class="req">Ajoutez votre dossier d'inscription (Pdf intéractif) *</label>
    							<input type="file" id="pdf" class="pdf" name="pdf" placeholder="Pdf" accept="image/pdf">
    
    						</div>
    						
    						
    						
    						
    						<div id="form-note">
    							<div class="alert alert-error">
    								<strong>Error</strong>: Please check your entries!
    							</div>
    						</div>
    						
    						<div class="form-row form-submit">
    							<input type="submit" name="submit_form" class="submit" value="Send" />
    						</div>
    				
    						<input type="hidden" name="subject" value="From Coeur à Prendre" />
    						<input type="hidden" name="fields" value="name,email,message," />
    						<input type="hidden" name="sendto" value="info@coeuraprendre.art" />  
    					</form> 
    				</div>
    				<!-- Contact form -->

     

     

    PHP CODE :

     

    <?php
    
    define("WEBMASTER_EMAIL", $_POST['sendto']);
    if (WEBMASTER_EMAIL == '' || WEBMASTER_EMAIL == 'Testemail') {
    	die('<div class="alert alert-confirm"> <h6><strong>The recipient email is not correct</strong></h6></div>');	
    } 
    
    define("EMAIL_SUBJECT", $_POST['subject']);
    if (EMAIL_SUBJECT == '' || EMAIL_SUBJECT == 'Subject') {
    	define("EMAIL_SUBJECT",'Contact');	
    }
    
    $name = stripslashes($_POST['name']);
    $email = trim($_POST['email']);
    $message = stripslashes($_POST['message']);
    $pdf = stripslashes($_POST['pdf']);
    
    
    $custom = $_POST['fields'];
    $custom = substr($custom, 0, -1);
    $custom = explode(',', $custom);
    
    $message_addition = '';
    foreach ($custom as $c) {
    	if ($c !== 'name' && $c !== 'email' && $c !== 'message' && $c !== 'pdf' && $c !== 'subject') {
    		$message_addition .= '<b>'.$c.'</b>: '.$_POST[$c].'<br />';
    	}
    }
    
    if ($message_addition !== '') {
    	$message = $message.'<br /><br />'.$message_addition;
    }
    
    
    $message = '<html><body>'.nl2br($message)."</body></html>";
    $mail = mail(WEBMASTER_EMAIL, EMAIL_SUBJECT, $message,
         "From: ".$name." <".$email.">\r\n"
        ."Reply-To: ".$email."\r\n"
        ."X-Mailer: PHP/" . phpversion()
    	."MIME-Version: 1.0\r\n"
    	."Content-Type: text/html; charset=utf-8");
    
    
    if($mail)
    {
    echo '
    		<div class="alert alert-confirm">
    			<strong>Confirm</strong>: Your message has been sent. Thank you!
    		</div>
    ';
    }
    else
    {
    echo '
    		<div class="alert alert-error">
    			<strong>Error</strong>: Your message has not been send!
    		</div>
    ';
    }
    
    ?>

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.