473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[SOLVED] Backslahes appearing in $message when using mail()

2
Hi everyone,

Wondering if someone could help me out please.
I am using a simple script to mail out on a contact form.

However when it is used and someone fills out a dash or a quote mark, in my email I get backslashes before them.

So for example someone was to write: My name's Fred and you have a "wonderful" website.

It would get sent to looking something like: My name\'s Fred and you have a \"wonderful\" website.

Can someone please tell me how I can get rid of these backslashes?? I have tried str_replace but it just spat out errors.

Expand|Select|Wrap|Line Numbers
  1. $to = "$myemailadd";
  2. $subject = "The Subject Line";
  3. $body = "$message";
  4. $headers = "MIME-Version: 1.0\r\n";
  5. $headers .= "Content-Type: text/html; charset=utf-8\r\n";
  6. $headers .= "From: $name <$email>\r\n";
  7. $headers .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
  8. mail($to, $subject, $body, $headers);
Thank you in advance!
Oct 13 '06 #1
2 1077
ronverdonk
4,258 Expert 4TB
Use the stripslashes function:
[PHP]$body = stripslashes($message);[/PHP]

Ronald :cool:
Oct 13 '06 #2
v12
2
Haha that simple huh?!
I'm sure I tried that out earlier to no avail ...

All sorted. Thank you Ronald. Legend.
Oct 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Charlton-Thomson | last post by:
Can anyone explain why my cookie is not appearing in the Temporary Internet Folder on my PC? It sets OK and I can test it put when I go to the folder it's not actually there? I am using the...
1
by: MKoleoso | last post by:
Problem: C#- Unable to create instance of a class implementing from an interface I have: namespace someNamespace { public __gc class SomeClass1 { }
5
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the...
1
by: new1s.on.sympatico.ca | last post by:
Hey There! Any one have any ideas on how to prevent the DOS window from appearing when executing an Output Assembly (exe) generated using CodeDom? Thanks, Roland
11
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to...
3
by: Craig Cockburn | last post by:
Hi I have a background image on this page http://www.siliconglen.com/craig/ which is no longer appearing, yet the image is there. could someone let me know why it isn't appearing? I assume...
6
by: AbraAbraCadabra | last post by:
Ok I think I've almost got my problem solved. I am using this code to send mail. I am simply pasting it into an .ASP page. Why doesn't this code work? I do have ..NET 2.0 installed, but I...
3
by: Ken Fine | last post by:
I am using ASP.NET's CreateUserWizard control. I want to force the visitor to use a username and e-mail address that I am providing in programming, and I do not want the visitor to be able to edit...
1
by: JINO1984 | last post by:
Hi, I am designing mail application. In that message body is in textbox. If i change the font size,color and style in the textbox using dropdownlist, it is changing in the textbox. But,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.