Hi

I would just like to add the logo of the company when an email has been received via this form. How can this be achieved?

<?php

//create short variable names	$name=$_POST['name'];
$name=$_POST['name'];	
$business=$_POST['business'];
$town=$_POST['town'];	
$zip=$_POST['zip'];	
$country=$_POST['country'];	
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$fax=$_POST['fax'];
$email=$_POST['email'];	
$web=$_POST['web'];	
$educ=$_POST['educ'];	
$feedback=$_POST['feedback'];
$toaddress  = 'test@mail.com' . ', '; // note the comma
$toaddress .= 'test@hotmail.com';
$subject = 'Inquiry and Registration Form';
$mailcontent = 	'Name: '.$name. "\n"
				.'Business Name & Address*: '.$business. "\n" 
				.'Town: '.$town. "\n" 
				.'Zip Code / Postal: '.$zip. "\n" 
				.'Country: '.$country. "\n" 
				 .'Phone Number: '.$phone. "\n"
				  .'Mobile Number: '.$mobile. "\n"
				   .'Fax Number: '.$fax. "\n"
			   .'Email Address: '.$email. "\n" 				  
			   .'Webpage: '.$web. "\n"

			   .'Comment: '.$feedback. "\n";


$fromaddress = 'From: Contact Form';	

mail($toaddress, $subject, $mailcontent, $fromaddress);

?>

Thanks

Eddie

    don't even bother with mail() its just to underpowered to do much, start with phpmailer

      thanks for your response halojoy but what I meant was that when the client receives the email then the logo will automatically be displayed as a header. Just trying to add a bit of style to a boring plain text response

      Thanks

      Eddie

        If it's plain text you won't be able to show it anyway. If you're sending as html then you can add it. I'd suggest you take dagon's advice and use phpmailer to do it, otherwise you'll be fiddling with base64 encoding and content boundaries

          Hey thanks for the reply as I have now changed everything to use phpmailer. How would I now then edit the following to embed my clients logo to appear in my clients email when someone uses the form.

           <?php
          
          /* config start */
          
          $emailAddress = 'test@hotmail.com';
          
          /* config end */
          
          
          require "phpmailer/class.phpmailer.php";
          
          session_name("solisten");
          session_start();
          
          
          foreach($_POST as $k=>$v)
          {
          	if(ini_get('magic_quotes_gpc'))
          	$_POST[$k]=stripslashes($_POST[$k]);
          
          $_POST[$k]=htmlspecialchars(strip_tags($_POST[$k]));
          }
          
          
          $err = array();
          
          if(!checkLen('name'))
          	$err[]='The name field is too short or empty!';
          
          if(!checkLen('billing'))
          	$err[]='The billing name and address field is too short or empty!';
          
          if(!checkLen('town'))
          	$err[]='The town field is too short or empty!';	
          
          if(!checkLen('zip'))
          	$err[]='The zip code / postal field is too short or empty!';		
          
          if(!checkLen('country'))
          	$err[]='The country field is too short or empty!';	
          
          if(!checkLen('email'))
          	$err[]='The email field is too short or empty!';
          else if(!checkEmail($_POST['email']))
          	$err[]='Your email is not valid!';
          
          if((int)$_POST['captcha'] != $_SESSION['expect'])
          	$err[]='The verification code is wrong!';
          
          
          if(count($err))
          {
          	if($_POST['ajax'])
          	{
          		echo '-1';
          	}
          
          else if($_SERVER['HTTP_REFERER'])
          {
          	$_SESSION['errStr'] = implode('<br />',$err);
          	$_SESSION['post']=$_POST;
          
          	header('Location: '.$_SERVER['HTTP_REFERER']);
          }
          
          exit;
          }
          
          
          $msg=
          'IP:	'.$_SERVER['REMOTE_ADDR'].'<br />
          Name:	'.$_POST['name'].'<br />
          Billing:	'.$_POST['billing'].'<br />
          Town:	'.$_POST['town'].'<br />
          Zip:	'.$_POST['zip'].'<br />
          Country:	'.$_POST['country'].'<br />
          Phone:	'.$_POST['phone'].'<br />
          Mobile:	'.$_POST['mobile'].'<br />
          Fax:	'.$_POST['fax'].'<br />
          Email:	'.$_POST['email'].'<br />
          Webpage:    '.$_POST['web'].'<br /><br />
          
          Education and Current Activity: '.nl2br($_POST['educ']).'<br /><br />
          Comments: '.nl2br($_POST['message']).'
          
          ';
          
          
          $mail = new PHPMailer();
          $mail->IsMail();
          
          $mail->AddReplyTo($_POST['email'], $_POST['name']);
          $mail->AddAddress($emailAddress);
          $mail->SetFrom($_POST['email'], $_POST['name']);
          $mail->Subject = "Solisten message from ".$_POST['name']." | Inquiry and Reg Form";
          
          $mail->MsgHTML($msg);
          
          $mail->Send();
          
          
          unset($_SESSION['post']);
          
          if($_POST['ajax'])
          {
          	echo '1';
          }
          else
          {
          	$_SESSION['sent']=1;
          
          if($_SERVER['HTTP_REFERER'])
          	header('Location: '.$_SERVER['HTTP_REFERER']);
          
          exit;
          }
          
          function checkLen($str,$len=2)
          {
          	return isset($_POST[$str]) && mb_strlen(strip_tags($_POST[$str]),"utf-8") > $len;
          }
          
          function checkEmail($str)
          {
          	return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str);
          }
          
          ?>
          

            You would need to encode the image using base64_encode and include the proper tags in your HTML to render the image.

            i.e.

            <image width="X" height="X">data:image/jpeg;base64,VGhpcyBpcyBhbiBlbmNvZGVdniasndoIASDNoin0329doAISNFEsdIFVC03498ncfvFn304efdkioaiDkIHN0cmluZw==</image>

            I made up the base64 string, so don't use it.

            edit
            I should note that I've never done this, but from what I read it should work.

              the mailer will do the encoding for you, you need to write the html, then send it as html not text, and include the image, the instructions with phpmailer should help.

                9 days later
                Write a Reply...