I am trying to send and email from a form using php. I got that to work.
The problem is that when I receve the email it is a text version with all the html tags showing.
looks like this: - <HTML><HEAD><TITLE></TITLE></HEAD><BODY><table width="440" border="1" cellspacing="0" cellpadding="3"><tr><td colspan="2"><em>The following was receved from the General Estimate form</em></td></tr><tr><td colspan="2" style="background-color:#2362ac; color:#FFFFFF;"><strong>I am interested in these type(s) of relocation:</strong></td></tr><tr><td colspan="2"><ul><li>Commercial</li><li>International</li></ul></td></tr><tr><td colspan="2" style="background-color:#2362ac; color:#FFFFFF;"><strong>Contact Info:</strong></td></tr><tr><td>Name</td> <td>jason</td></tr><tr><td>Company Name</td> <td>questfore</td></tr><tr><td>Phone Number</td> <td>234-567-8907</td></tr><tr><td>Best Time to Contact</td> <td>Morning</td></tr><tr><td>Email</td> <td>jasons@questfore.com</td></tr><tr><td>City</td> <td>pittsburgh</td></tr><tr><td>State</td> <td>pa</td></tr><tr><td>Zip</td> <td>15203</td></tr><tr><td>Country</td> <td>use</td></tr><tr><td>DesCity</td> <td>imperial</td></tr><tr><td>DesState</td!
-
> <td>pa</td></tr><tr><td>DesZip</td> <td>15126</td></tr><tr><td
-
> colspan="2" style="background-color:#2362ac;
-
> color:#FFFFFF;"><strong>Special
-
> Circumstances:</strong></td></tr><tr><td>PackSrv</td>
-
> <td>yes</td></tr><tr><td>Storage</td> <td>no</td></tr><tr><td
-
> colspan="2" style="background-color:#2362ac;
-
> color:#FFFFFF;"><strong>How did you hear about
-
> Weleski?:</strong></td></tr><tr><td
-
> colspan="2"><ul><li>Television</li><li>Invite</li><li>Web</li><li>&nbs
-
> p;</li></ul></td></tr></table></BODY></HTML>
should look like this: (tags shouldn't be showing only a table with all data) -
<table width="440" border="1" cellspacing="0" cellpadding="3"><tr><td colspan="2"><em>The following was receved from the General Estimate form</em></td></tr><tr><td colspan="2" style="background-color:#2362ac; color:#FFFFFF;"><strong>I am interested in these type(s) of relocation:</strong></td></tr><tr><td colspan="2"><ul><li>Commercial</li><li>International</li></ul></td></tr><tr><td colspan="2" style="background-color:#2362ac; color:#FFFFFF;"><strong>Contact Info:</strong></td></tr><tr><td>Name</td> <td>jason</td></tr><tr><td>Company Name</td> <td>questfore</td></tr><tr><td>Phone Number</td> <td>234-567-8907</td></tr><tr><td>Best Time to Contact</td> <td>Morning</td></tr><tr><td>Email</td> <td>jasons@questfore.com</td></tr><tr><td>City</td> <td>pittsburgh</td></tr><tr><td>State</td> <td>pa</td></tr><tr><td>Zip</td> <td>15203</td></tr><tr><td>Country</td> <td>use</td></tr><tr><td>DesCity</td> <td>imperial</td></tr><tr><td>DesState</td> <td>pa</td></tr><tr><td>DesZip</td> <td>15126</td></tr><tr><td colspan="2" style="background-color:#2362ac; color:#FFFFFF;"><strong>Special Circumstances:</strong></td></tr><tr><td>PackSrv</td> <td>yes</td></tr><tr><td>Storage</td> <td>no</td></tr><tr><td colspan="2" style="background-color:#2362ac; color:#FFFFFF;"><strong>How did you hear about Weleski?:</strong></td></tr><tr><td colspan="2"><ul><li>Television</li><li>Invite</li><li>Web</li><li> </li></ul></td></tr></table>
Please help, I think it has something to do with the header data but I don't know what to put.
Thanks
- Jason
5 1966 pbmods 5,821
Recognized Expert Expert
Heya, Jason.
To send an HTML Email, you need to set a couple of headers.
Check out this example.
Thanks for the link. I inserted the code for the header and still no luck.
Could it be a php security thing?
here us the code i am using:
[PHP]
$cancelSubmissi on = false;
if(!isset($_POS T['formName'])){exit('Error: no form name found!');}
//if(!isset($_POS T['submit'])) {exit('Error: submit was not pushed!');}
//This value defines the subject
$strSubject = "Message from the website - form: " . $_POST['formName'];
//This value defines the sender and receiver email addresses
$strSender = "" //where the email is from (probaly don't need this, it's automaticly generated by the server)
$strReceiver = "" //my email address
//This value defines the re-direction of the browser after submission
$strRedirectURL = 'acknowledgemen t.htm';
//This value defines body of the email
//a bunch of code that cleans up the form data for the client
//it creates the muli-dimentional array used below
//Create table with titles for each section
$strMessage = "<HTML><HEAD><T ITLE></TITLE></HEAD><BODY>";
if($fArrayMulti[0][1] == "general_es t" ){
//a bunch of code that makes the table
}
//Check to make sure email is not garbage
if(($fArrayMult i[$part[0]][1] == ' ' || $fArrayMulti[$part[0]][1] == '') && ($fArrayMulti[$part[0]+2][1] == ' ' || $fArrayMulti[$part[0]+2][1] == '')){
$cancelSubmissi on = true;
}
//Compile mail and send it
//if(cancelSubmis sion != true){
//add header
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if(mail($strRec eiver, $strSubject, $strMessage, $header)){
echo "Mail Sent.";
}else{
echo "Error sending email! Message not sent!";
}
//JS_redirect( $strRedirectURL );
//}else{
//JS_redirect("../../home.htm");
//print("Submissi on canceled");
//}[/PHP]
pbmods 5,821
Recognized Expert Expert
Heya, Jason.
When you send the mail, you use $header instead of $headers. Is this intentional?
YOUR a freakn genius!
and i feel retarded...
I must have copied code a while ago and never changed it in the mail() function
Thank you so much!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!
-Jason
pbmods 5,821
Recognized Expert Expert
Heya, Jason.
Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: bojanraic |
last post by:
Hi!
I recently started playing with Python CGI, and I was happy that my
basic input-name--print-hello-name CGI form example worked, so I
thought I should advance to somew\hat more complicated scripts.
I'm trying to write a basic Python email CGI script to send email
through HTML email form.
I've seen a lot of examples out there, but nothing I tried so far
seemed to work. So I would like to know what I am doing wrong.
|
by: BaWork |
last post by:
I have a web form where a client can select which site members to send
an email to.
This form is populated from the contents of the member table, so the
form can have 0-x names listed on it depending on member expiration dates.
When the form is submitted, the code loops through the form contents and
sends an email to those members that meet the selected criteria.
All this worked perfectly when I was sending text emails, but since I
|
by: Zaidan |
last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA
code (I will consider using javascript if I have to) that does the
following, at the user command:
1- Start MS Explorer and go to my website. Login (enter ID and
Password)
2- It will go and update some prices of some products that I sell
3- It will add new products or cancel some product
I already have someone who wrote me in JavaScript a web form (no
documentation...
|
by: Marcin |
last post by:
Hello all!
A few years ago I created a form with button which let me send an email
with an attachment. It was created in Access 97. Now I would like to
move this application into Access 2003. But when I did it, sending email
code doesn`t work. Can you be so kind and give me the code how to send
email with and without attachment in vb in Access 2003??
Thank you in advance
|
by: prasenjit2007 |
last post by:
Hello,
can u help me sending Email with attachments using the Class phpMailer.
On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name) 2)To 3) Subject 4) Message5) File input(name abc) - to be sent as an attachment.
This form calls the Class PhpMailer through another form with the following code to send the mail.
<?php
ini_set("include_path",...
| |
by: Oltmans |
last post by:
Hi All,
I'm trying to send an HTML email from my asp.net 2.0 application. I
want to show an "alert" message when user opens up my email message
using JavaScript. Though I've been able to send email but I am
*unable* to show an alert message using JavaScript. Any ideas, please
enlighten me. Thanks.
Here is my code
|
by: undbund |
last post by:
Hi I am creating a newsletter system. The software should run from
desktop computer (localhost) but be able to send email to anyone on
the internet. Can you guys give me some ideas on how to achieve this.
Thanks
|
by: lstanikmas |
last post by:
Hi, I'm validating a form with this ASP but receiving some blank email
responses; does anyone see anything wrong with it?:
function isFormVarExcluded(thisForm, strToCheck)
{
var strExcludeVars = thisForm.elements.value;
var arrExcludeVars = strExcludeVars.split(",");
for (var j=0; j<arrExcludeVars.length; j++)
{
if (arrExcludeVars == strToCheck) return true;
|
by: wktarin |
last post by:
Hi. I'm a relative newcomer to the world of php, and I keep bumping into a problem with a mail () form. I need to send an automatic email to two addresses, but I can't seem to get it to work. One email address works just fine, but I can't get the email sent to two different addresses no matter what I try. Below is my code. If someone could help me spot my errors, I'd appreciate it. Thanks!
Code from actual page:
<?php
//Check if the form...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |