Jump to content

Help adding an image to auto email on Form2Email script.


yiaggi

Recommended Posts

Hi guys,

 

I am really stuck with a bit of coding and hope you can help!

 

I am fairly new to PHP although I have got a few trusted scripts that have been tweaked throughout the last few years that I call upon whenever I need to use it. I am trying to expand my knowledge so have a fair idea I will be on this forum a bit! I am a web designer but would like to move onto programming soon.

 

Basically - I have been using a FormToEmail script to do web forms for a long while now as it has never let me down and always gives me the result I need.

 

The form is very simple and i'm sure will offer no suprises to you PHP geniuses! It simply activates when submit is clicked and pushes an email to the user saying 'thank you' and one to the company giving the details from the form.

 

The email sent to the user is where I have my issue. Instead of just plain text saying thank you - this group want the email to have their company logo at the top.

 

I am used to HTML emails and what is required to make them work. My first guess was to just add a line in my code within the <html> tags that display the message.

 

When I do this thou and go to my form to hit submit - I get a very strange result. Instead of displaying the "Thank You" text on screen like it normally does - I get a blank screen and the emails do not send to either party.

 

I'm obviously going about this the wrong way but am a bit stumped as to what I am doing wrong. I have a feeling that I need to add something to the PHP but I have no idea what!

 

Here is the part of the code that relates to sending the email to the site user:

 

-------------------------------------------------------------------------------------------

 

$headers = "To: ".$email. "\r\n"; // this is the email given by the visitor

$headers .= "From: ".$my_email. "\r\n";

$headers .= "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

$subject = "Thank you for your interest";

$msg = "

<html>

<head>

<title>Thank You! </title>

</head>

<body>

<p>

Thank you for your email etc ..........

</p>

</body>

</html>

";

mail($email,$subject,$msg,$headers);

}

?>

</head>

<body>

 

------------------------------------------------------------------------------------------------

 

Can anyone help me? Please feel free to email direct! I can post more of the code if it is needed. Would be most grateful to anyone who has a spare 5 mins to tell me what i'm doing wrong!

 

 

Link to comment
Share on other sites

You say that is part of the script.  I would guess you have a <head><body>etc. above the headers.  Writing output before headers is a NoNo and the headers won't work.

 

You should use

$output = <MTML><HEAD>........

headers

headers

mail

echo $output

 

 

Although if it worked previously it must have had something similar in. Did you completely rewrite it?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.