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

Download Image from URL and Upload it
Ok, I have been googling for the last 1/2 hour trying to figure this out, Most likely I'm just not s

Procedural to OOP
John Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pr

retrieving images from mysql database using php
So I've been trying to figure out how to store images in a mysql database, and as far as i can tell

PHP Code reffering to database, doing something wrong.. pls help
Well i am quite new with PHP
and for school we have to make a PHP script which reffers to a Data

How to validate from 2 possible answers
Hi

I hope somebody can help me with what will probably be really simple, I'm pulling my hair

Best way to cross matching large datasets
Hi,

Im running a script where am I cross matching about 200 000 data sets with each other. Ea

Problem with php's rename function
So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempt

line breaks in between fetched file names
Hi,

I have this code:
Code: <?php
if($dir = opendir('files')){
while (($f

Take info from one coloum and move to another
Hi all,

I have this:
Code: [Select]$array = "SELECT stock_id FROM stocks WHERE stock_

Change of partner analyse in sales orders
Hello,

I changed the partner analyse for sales orders and added a new mandatory partnerro

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