473,789 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending a HTML e-mail message

142 New Member
Hi, I tried to get a script or something to send my e-mial in HTML format becasuse I want to add tables to line up certain text.

How do I get the e-mail to go from plain text to HTML?

Thanks

[PHP]
<?php
$con = mysql_connect(" ******","****** ","****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_d b("total", $con);$result = mysql_query("SE LECT * FROM email");while($ row = mysql_fetch_arr ay($result))
{
$to = "$row[a1]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@exa mple.com";
$headers = "From: $from";
mail($to,$subje ct,$message,$he aders);
echo "Mail Sent.";

}mysql_close($c on);
?>

[/PHP]
Dec 11 '07 #1
1 1437
brettl
41 New Member
You'll have to add the following to your headers variable:
Expand|Select|Wrap|Line Numbers
  1. $headers  = 'MIME-Version: 1.0' . "\r\n";
  2. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  3.  
Then just build your html in your message variable like so:
Expand|Select|Wrap|Line Numbers
  1. $message = '<html><head><title>Some Title Here</title></head>';
  2. $message .= '<body><p>So and so sent you this url';
  3. $message .= '<a href="http://www.somedomain.com/url.html" title="URL Title">Url Title</a><br/>';
  4. $message .= 'And a message : <br/>';
  5. $message .= $mailMessage.'</p></body></html>';
  6.  
Hope this helps. Let me know.
Dec 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2894
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's webmail. And I know they work on *my* Outlook Express. But I have one person (I know of) who gets the emails as plain text, so she sees the HTML code for the email instead of its proper representation. She has, like myself, OE6, and other html emails...
2
1669
by: Brett | last post by:
I have a client that wants to send HTML based email. Building and sending isn't a problem, but he wants to include a plain text link at the top of the email that will display if the user doesn't not accept HTML email. Maybe it is the product we are using to send the email, but there is no way to include non-HTML formatted text in the email. Is there a way to send non-HTML and HTML in a single email? Thanks.
3
10171
by: John Chen | last post by:
I need to use iframe to create a floating frame. But the contents in the iframe is not a external html file. Rather, it will be dynamically created by jsp. How can I set the src attribute to a URL of a dynamically created html contents rather than a static html file. Thanks.
5
2565
by: fochie | last post by:
Greetings, I'm trying to send data to my server using xmlhttp POST. The data being sent is actually an HTML page that is built with javascript in the browser. The HTML code contains a small javascript function in the <HEAD> section. I applied encodeURIComponent to the data prior to sending it but anything between the <script> </script> tags does not get sent. The tramsmitted data is cought by a Perl script on the server, it handles the...
5
1767
by: vanisathish | last post by:
Hi All, I need to constantly update some values to the User Interface. In order to do the updation efficiently, i am planning to run some script in the server side that constantly keeps sending the values alone to the User Interface client. But i need to send some GIF files as well to change the colour of the block diagram. something like send a green arrow when the equipment is UP and red arrow gif file when its down. How can i avoid...
2
9243
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends - I see hebrew, it is just sending by myself using *.aspx scripts). In web.config I have the following : <configuration> <system.web>
2
1646
by: Marcelo | last post by:
Hi guys, I'm using the following code to send values from one page to another, but seems to me, that the event Page_Load in the receiving page never fires. Why? This is the code: Thanks -*-*-*-*-*-*
6
2795
by: Piedro | last post by:
Hi, has anyone in here got a good example or some hints on how to send a file directly from one pc to another pc using vb.net, for example I've got my pc's ip and a friends pc's ip and I want to send him a file or he wants to send me a file, it just needs to be a very basic program for sending files up to maximum 6mb. thnx a lot Peter
4
12152
by: yawnmoth | last post by:
Is it possible to send http requests with curl but not have curl wait for the response? The reason I ask is because I'd like to code a web app that can sorta start time consuming processes without the user having to wait. I'm doing this (with fsockopen) by sending an http request to a page that does the time consuming stuff and then immediatly closing, without having read any of the response. This way, I don't have to wait for the...
1
2945
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux hosting plan. This time, it's PHP 5. Things are bound to not work as expected moving to a new...
0
9499
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10121
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,...
0
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
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();...
0
5404
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...
0
5539
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4076
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
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.