Images in email problem


Posted on 16th Feb 2014 07:03 pm by admin

I found this script for sending emails, it works but if the email has <img src="image.jpg"/> it will send this &lt;img src="image.jpg"&gt; &lt; I tried to replace &lt; &gt; &lt; with the right characters but it doesn't work. Any suggestions?
Code: <?php

/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$slashes= stripslashes($message);

/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/", $email)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}

/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$slashes)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>

No comments posted yet

Your Answer:

Login to answer
232 Like 13 Dislike
Previous forums Next forums
Other forums

Help with Password Encoding/Decoding?
Trying to design a "change password" tool. On my signup code I'm using base64_encode, now

How can I Compare two xml documents?
Hi all,

I am doing a POC for my project and I am using XE database 10g version.

Mysql error message
help me find out what this error message means:

"Duplicate entry '0' for key 'PRIMARY'&q

the problem with str_replace
$str="hahahahahahahahahahahahahaha";
$nn=1;
$str=str_replace('ha','MyGod',$str,$nn);

Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,

In our current landscape SAP ECC 5.0 is integrated to MES system via PI 7.

Login page problems
I developed a website a few months ago and I am now having an issue with logging into it. The place

Get relative path from absolute path
How would one go about getting the relative path to a file from its absolute path?

opening a window with after form submission
I know this this forum has nothing to do with JS, but i'm trying to use it with my php script.
<

AutoChoosing a CSS file based on URL
Hey everyone,

I have a site that has multiple URLs and CSS files.

Based on the URL tha

Warning: session_start() [function.session-start]: Cann.....
hi, can someone help me with this? I keep getting this error....

Warning: session_start() [fu

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash