Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Sending Both HTML And Plain Text Email.


I am using php to send weekly newsletters to my mysql database, the emails are always in HTML only.

I was wondering if anyone knew how to send both types so that if they can't view HTML emails it will show just text?




View Complete Forum Thread with Replies

Related Forum Messages:
Sending Plain Text Email
I have created a survey and I would like the results of the survey to be emailed the boss in *plain text*.

Can someone PLEASE take a look and tell me why carriage returns are not being inserted after each $body ? The email comes out as one big line. Code:

View Replies !
How To Send A Plain Text Version Of An Email With Html
how can u send a plain text version of an email with the html so that
the users mail client can access this plain text version?

View Replies !
Sending Text And Html In One Email
i've put close to 10 hours into this today and i'm not getting results. i simply want to create and send emails that can be viewed by both text based and html based email clients. i've scoured the PHP manual and related comments and nothing is working. I also don't want to use a big bloated open source library as my needs are simple...text...html...that's it. 

can someone point me to code that's working for them (across all popular email clients) or to a tutorial that actually works?

View Replies !
Sending Plain Text E-mail, Trying To Track Accesses
i am using php to dispatch from time to time using the mail() function. i have the message split into an html form and a plain text form, only one displays depending on the recipients mail client. my html message includes a 1x1 "image" that is really a php script, which allows me to track reads on the html version... but i don't know of a way to track reads/views/accesses/etc on the plain text version. is this possible?

View Replies !
Plain Text Email
I'm wanting to protect all inputs for sending a plain text email, in a common
routine.

Have just found POSIX [:print:] which I thought looked useful.
I didn't want to use htmlentities(); because it's a plain text email.

Would this protect me from anyone sending spam though this?

$raw = stripslashes($raw);
$raw = preg_replace("/(content-type|bcc:|cc:|onload|onclick)/i", "DELETED",
$raw);
$raw = strip_tags($raw);
$raw = preg_replace("/[^[:print:]]/", " ", $raw);
$raw = substr($raw, 0, 500);
$raw = trim($raw);

Or, should I use:
$raw = htmlentities($raw, ENT_NOQUOTES);

The email address would obviously be different.
This would cover just the name, subject and message.
I don't need newlines etc.

View Replies !
Plain Text Email Spacing Issues?
PHP Code:

// create final message, $text refers to the textarea they typed the original message in $message2 = "Dear $firstname,

$text

Regards,
The Team......

View Replies !
Mail() Plain Text Vs. Html Format
I have been testing the mail() code below using MS Outlook and Outlook Express and a hotmail account and the details sent are always in "plain text" format, which results in the information being nicely aligned (incidentally the e-mail contains order confirmation with lots of columns).

However, my customer came back to me this morning to tell me that all is not well ! And rightly enough, when I looked at the snapshot he sent me he is receiving it in "html" format. What am I doing wrong ? Keeping in mind that I am a PHP greenhorn ... Can anyone help. Thanks in advance !

$headers = "From: info@somecompany.com
";
$headers.= "X-Sender: <info@somecompany.com>
";
$headers.= "X-Mailer: PHP
";
$headers.= "X-Priority: 1
";
$headers.= "Return-Path: "."<info@somecompany.com>
";
$headers.= "cc: info@anothercompany.com
";
$headers.= "bcc: me@mycompany.com
";
$headers.= "MIME-Version: 1.0
";
$headers.= "Content-type: text/plain; charset=iso-8859-1
";

if(@mail($to,$re,$msg,$headers))
{
// tell them all was sent fine
}
else
{
// give an error message
}

View Replies !
Turning Newsletter From Plain Text Into HTML
I have a Newsletter script that outputs just raw text, even when I try to include some HTML. I would like to know how to change it from plain text to HTML. Here's the script:
PHP Code:

View Replies !
Text/plain Or Text/html?
I have a site (that someone else programmed) and I'm trying to fix a problem with the email formatting. There are five or six php scripts that send an email after registration, renewal, etc..

The only script that sends an email which is formatted correctly (ie, with line breaks in the body) is the one that says:

$headers .= "Content-type: text/plain; charset=iso-8859-1";

The scripts that say text/html DON'T format the emails correctly. Isn't this backwards? Or should I just change all of the scripts to text/plain and not try to make sense of it?

View Replies !
Regular Expression To Remove All The HTML Elements And Only Leave The Plain Text.
I am trying to take some HTML and remove all the HTML elements and only leave the plain text. Basically I am trying to extract information that was put into an HTML table. I have a regular expression which catches the HTML elements, it is <.*?> but I actually want the inverse of this, that regular expression returns the HTML elements to me, I want the plain text. I tried doing [^<.*?>]+ but square brackets will only work with 1 character at a time, so it is not seeing <.*?> as a whole.

View Replies !
Send A Email With Html As Well As Php.sending The Email
im trying to send a email with html as well as php.sending the email is the easy part.the problem is with the message part.if i put this code in the textarea it display the html tags in the email.yet the php is fine. Code:

View Replies !
Sending Html Email Using Php
I'm trying to send a html email using php (and it think qmail)

Here is the code i have so far:

$headers .= "MIME-Version: 1.0";
$headers .= "Content-type: text/html; charset=iso-8859-1";
send_mail($row["UserID"], $subject, $message, $headers);

Why does this not work?

Here are the headers i get in my email client:
Return-path: <root@server1.domain1.com>
Delivered-To: 1-owner@domain1.com
Received: (qmail 15148 invoked by uid 48); 7 Aug 2004 15:14:01 -0000
Date: 7 Aug 2004 15:14:01 -0000
Message-ID: <20040807151401.15147.qmail@server1.domain1.com>
To: owner@domain1.com
From: webmaster@domain2.com

View Replies !
Sending Html Email
I tried adding <html><body> etc to the contents of the email I send with the php function php() but I just can't seem to get it to show up as html... is there some trick I need to know to achieve this?

View Replies !
Sending Html In Email
how to send email with html codes?

View Replies !
Sending A HTML Email
I was just emailing text but it's becoming quit messy so thought I'd try and send it as a HTML, I have been able to format it and I can get a result from the top of the page, but how do I combine that with all my php & SQL Query? Code:

View Replies !
Sending HTML Email With Mail();
i have set up this script from other scripts but sometime it does not send any email and other times it does
with this im not shure why,i have edited other mail scripts and finaly come up with this which when it works works well.
there are two identicle mail functions there the first sends a email to the user saying thanks for registering the second sends a email to 4 admins telling them about the new user.

can you pick out why it,s not working?

View Replies !
Sending Html Email Using Php Script
I am trying to send a html email from a php script. This script emails
a common information to all the members in the database. The only
problem is I cannot specify colors, hyperlinks etc..Html tags like
<h1></h1>, <br/>, <b> etc works though..

Could any one tell me what i might be doing wrong?

Code:

View Replies !
Sending Html Email By Domains
i have a small idea about a function i could pass the email address through and if it returns true then send s the user a html email else they will get a text email. is this a good way of doing this? PHP Code:

View Replies !
Sending Forms Via HTML Email
How do I sent content of a PHP form via HTML email?

For example, fields $name, $city, $state, $phone, $location

to HTML:

<p>Congratulations $name from $city, $state with the phone # $phone .
You now get an expense paid trip to $location .

And that HTML outputted in email..so someone checks their email,they
have an HTMl certificate generated from a form in PHP.

View Replies !
Sending HTML Email Using The PHP Mail Function
I am encountering a very strange problem when sending HTML email using the PHP Mail Function. Each email that goes out has a "! " inserted into the body of the message... I have checked the body code and it is definitely not in there...

View Replies !
Sending The Contents Of A Php Array In A Html Email
I'm creating a site that posts orders to an email address when they're
submitted, these orders need to be in the form of official invoices so
i'm using HTML to format them.

I already have a shopping basket system which adds all of the totals
up and puts them into a nice looking invoice.

What's the best way to take this HTML and put it into an email?
I'm really looking for a way of sending the page via email, like you
can do in IE by selecting File > Send > Page by Email.

The basket script is quite large and i'm trying to avoid running it
more times than neccesary.

View Replies !
Sending Html Email Using PHP Default Method
Can we send HTML emails using PHP's default mail method?

View Replies !
PHP HTML Email Doesn't Format The Text Using The Html Tags
I had a PHP script that sent an html email from a Flash form. It was all working on a Windows based server. Then my server was switched to a Linux based one. It now sends the email, but has a lot of random characters and doesn't format the text using the html tags. Code:

View Replies !
Sending Php/html Document As An Email Using Php Mail() Function
I need to send the following code in an email ... but its a mix of php and html, and it retrieves various values from a database before sending...oh and i wouldnt mind the sending of the mail to be done on a button click!;)...anyways i have messed and messed but i aint too sure whether it can be done! Can someone please tell me the code and where i need to place it within my code? .....

View Replies !
Html Text In Email
i want to send them in mail. and wanted to display them as a html page. i have tried but in mail it displayed the html code not the result.

<table><tr><td> jkshio sv9puips opi opg pgig g <a href ="to link </a> some bold <b>text will be here </b></td></tr></table>


View Replies !
How To Read HTML Email Text?
I've done a couple of hours web-searching without turning up many
answers so far, and I guess I could figure it out (eventually) from
the MIME format, but here goes with my question...

I don't have any problems reading text emails, but can anybody direct
me to some PHP source code that will read (the text inside) an HTML
email, specifically the "From", "Subject" and especially the message
body?

I would like the code to be able to differentiate between (i.e. know
that it is) a text or an HTML email, and I would like the code to
ignore any attachments.

I don't expect the incoming email to have any (or large) attachments,
but I hope that any code samples can handle the possible case of big
attachments coming along for the ride.

Incidentally, if I did (not this time) want to handle large
attachments, can PHP and/or servers handle megabytes of data being
read into a string variable through fread()? I'm just getting into
this stuff, and not sure of what areas would be a resource and/or
performance hog.

View Replies !
Displaying Text/html In Web POP Email
is it possible that message from web POP mail ( through sockets) appears as html (or text) if it is sent as html, not to appear like source file of the html document? I use web POP mail which is not mine and it displays without problem emails sent as text/plain but shows complete source with all tags if the email is sent as text/html, in other words, it´s useless and very hard to read for user.

View Replies !
Csv Using Text/plain
I am using Excel to save a spreadsheet in .csv format. This creates a text file with extension .csvBut when I try to upload the file to the server by checking for its MIME type using $_FILE['userfile']['type'] I get my own error message that the file is not text file.

If I change the extension to .txt I am able to upload the file. This is not reliable as it is only relying on extensions rather than contents of the file. Is there a reliable way of checking for file formats. I would like to upload jpeg, gif and text files reliably.

View Replies !
Plain Html
why does this not work? it does not open the new window. however when i do just plain html. it works just fine. so i just have my close my php tages and do it the html / php way? PHP Code:

print('<a href="http://www.nightlance.com/?link=matches" ONCLICK="window.open("http://www.nightlance.com/match/view/view.php?match='.$Challenged['Match_Id'].', "NewWindow","toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,width=635,height=260")">'.$Challenged['Match_Id'].'</a>');

View Replies !
Problem With Sent Text/html Email + Attachments
I send a newsletter from script online. Email is sent in txt and html format, and this is ok The problem is with the attachment. I see and can open attachment ONLY in outlook express I copy below header's email Code:

View Replies !
Can`t Output To Text/plain
I`d like to show my MySql query results in a plain text style. So inside my php file I wrote:

View Replies !
Plain Text Database
i'm really a newbie to php but not OOP.

i'm designing a database to hold simple text messages to display in a
page called, "News". The client doesn't want a sql database so I
suggested a plain text database. I have it working but when I pull the
data (fopen) it all comes back as one line.

It's set up as a simple form passing 2 variable, $title and $comments.
They both write (fwrite) just fine to the .txt file but upon
retreiving them (fopen) it's all one line. Since I can't pass formated
text to a .txt file is there a different way?

As a newbie I haven't come across a solution yet. The client wants
this soon so I'm asking here due to the timeline. Given a few more
weeks I'm sure I'd stumble across it in some text.

View Replies !
RTF To Plain Text Conversion
does anyone know of a good PHP "module" -- or something else that I can invoke from a PHP script -- that will perform a simple conversion from Rich Text Format (RTF) to plain text with line breaks? I want to store some data in a MySQL database in RTF and allow users to preview the data as unformatted text (except for line breaks/paragraphs) on a webpage before deciding whether to download a file containing the RTF data. I'd rather not try to hack something out myself if I don't have to. The RTF files are likely to be created with Microsoft Word.

View Replies !
Reading Plain Text
I have a small file wich i would like to insert in a database. the file has information from different users every line everyfield is separated with a coma. How do i read this with php so i can insert it?

View Replies !
Extract Only Plain Text From A Page
Basically, what I am trying to do is write some PHP code that will automatically take text from any web page and eliminate all the HTML, CSS, and JS codes and formatting, leaving only the plain text from the page. I got my code started, but I have hit a snag with javascript and css codes. This is what I have so far:

<?php
$geturl = $_GET["url"];
ob_start();
include($geturl);
$page = ob_get_contents();
ob_end_clean();
$output = ereg_replace('<script.*.</script>', ' ', $page);
$output2 = ereg_replace('<style.*.</style>', ' ', $output);
$plaintext = strip_tags($output2);
echo $plaintext;
?>

The strip_tags function automatically removes all html tags, but it doesn't do anything to javascript and css because html code is not provided between the beginning and end tags, whereas javascript and css codes are both contained within two separate tags, like this for more clarification:

html:
<div name="htmltag">Keep this text here</div>

javascript:
<script>function somejs() {remove all this code}</script>

As you can see, the text between the div tags should stay, but the js between the script tags should be removed because it is code.

I then tried the ereg_replace function to get rid of js and css codes, but there is a problem when there is more than 1 piece of js or css code. The wildcard value (.*.) skips over any ending script or style tags until it reaches the last ending tag, therefore deleting all the text between the two pieces of code. Example:

<SCRIPT>function somejs() {remove all this code}</script> //removes all text and code from beginning here
KEEP ALL THIS TEXT HERE
<script>function somejs() {remove all this code}</SCRIPT> //to end here

Now finally down to the question, is there any way to only remove the js and css code between the beginning tag and the immediate next ending tag? Or is there any other way to get rid of the javascript and css codes?

View Replies !
Convert MS Word / Rtf / ... To Plain Text
i'm looking for standalone libraries that convert documents to plain text so i can let people edit the text in a textarea after uploading. One thing to notice is that i can not use COM because i can't configure the webserver.

Does anyone has interesting classes that are able to do this. I found a PHP class for ms word documents at http://obninsk.name/obninsk_doc/ but that doesn't work at all for my word documents.

View Replies !
Display Code As Plain Text
how to display code as plain text on an html page? I've tried using <PRE> and <TEXTAREA> but that isn't working. <LI> is still transformed into a bullet, and other things like that keep happening. <TEXTAREA> just makes it look really messy. Basically, I want something exactly like this: PHP Code:

<?

if (isset($_POST['submit'])) {
  echo "This is exactly what I want to do.";
} else {
  echo "Dangit. I can't figure it out.";
}

?>

View Replies !
Phpinfo() Outputs Plain Text
When I execute a file with the phpinfo(), it outputs plain text instead of html.
I've read that is has got to do with CLI (command Line ...).

Config:
Windows Xp
IIS
php: 5.1.2

What do I need to change to get html output (and where can I find it)?

View Replies !
Encoding A Plain Text File In UTF-8
I need to export database values to the contents of what will be a rather large file of around 100 MB into UTF-8 format.

If I encode each line before it is written using utf8_encode(), could I expect to run into any problems decoding the file later?

Also, would the file automatically be detected as UTF-8 by any editor or would I need to change some file attribute to designate it as UTF-8?

The file can't have any XML tags in it.

View Replies !
Get File Contents As Plain Text
How can i get the html of a webpage not located on my server and check to see if the a div with the class myclass is present in the document if it is return the contents in between the div. In this case it would be: Hello this is a class

<div class="myclass">Hello this is a class</div>

View Replies !
Modifying A Plain Text File
i have a text file with (ID - client name) like this:

01-bill
02-matt
03-john
04-martin

I want to open this file, search for the id (ie. "03") and change the name "john" for another. How can i do this? How can i change an entirely line and save the results?

View Replies !
Plain Text Table Simulation
I'm currently working on an ecommerce project that requires the system to send out reciept emails after each order has been completed. I notice in own store email receipts that they're all plain-text, which is fine by me, but they also manage to format their text so that it appears as if there are tables in there for listing the products i've bought.

View Replies !
Saving To Plain Text File
I want to do exactly is open a file that essentially has alot of variables stored in it like this.

$names = 'joe¦bob¦clem'
$phone = ?¦323232'

And it just goes on like that for a few hundred variables. Now all I want to do is open the file up find a certain variable and then just add the string I have to it. So like I have the new $names variable and it contains 'joe¦bob¦clem¦chris' and I just want to save that string to the file. I know it's possible but I usually work only with mySQL so I don't know how to open a file find where I want to edit, edit it and then save the file.

View Replies !
Web Pages - Plain Ole Html Format
I am halfway through installing PHP on a Win 2003 Server with IIS. I have other websites stored on this server in plain ole html format. Will PHP affect these sites in any way? I just don't want them all messed up..

View Replies !
Inserting/parsing Plain Text With 'require'?
I am trying to setup a very simple site that will pull text files into an existing template. I am using a simple require
statement, such as:

<?php
require "/www/companyname/body.txt"
?>

The first problem is that it does not seem to respect the linefeeds, which are saved in Unix format, and just lists it as one
massive block of text. The second problem is that, obviously, it does not convert symbols such as '&' to '&'.

The reason behind this way of including text into HTML files is so that the lecturers can write articles without having to
deal with HTML and the articles are inserted into the HTML templates with the 'require' statement. Also, the shear
number of text documents that need to be posted would cause a lot of work. I have looked at Project Midguard, but I
tend to shy away from applications with little documentation, even though that would be absolutely ideal.

View Replies !
Application/octet-stream Vs Text/plain When Uploading
when testing Zend's file upload script, i uploaded a file (sql.txt that was a sql backup) and $_FILES reported it as text/plain as it should. as soon as i renamed it to sql.sql, $_FILES now reports it as application/octet-stream. all i did was rename the file. to make matters worse, i thought Windows XPpro was adding some bits to the file to explain $_FILES new type so i renamed sql.sql to sql.exe; $_FILES now says it is text/plain, even with the .exe extention.

does anyone know why adding the .sql extention would change the type from text/plain to application/octet-stream?

btw, the webhost is a linux box (RH).

more tested extentions (renaming sql.txt to the following extentions)
.sql - application/octet-stream
.php - application/octet-stream
.gz - application/octet-stream
.tar - application/octet-stream
.htm - text/plain
.html - text/plain
.txt - text/plain
.exe - text/plain
.gif - text/plain
.jpg - text/plain
.asp - text/asp
.rpm - audio/x-pn-realaudio-plugin
.wav - audio/x-wav
.mp3 - audio/mpeg

(all i'm doing is changing the extention, nothing more. opening the file in notepad looks all ascii, no funky characters)

View Replies !
Phpmailer.class Messages Are Been Converted To Plain Text...
I am using a phpmailer class to send some staff over the email...

I am tring to send it with text/html but for some reason the email are
been converted to plain and all the headers are shown, here is the
email...

X-Tour4Less.co.il Mailer:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_27976937fb6a931b3ed2d40aebd76a26"

--b1_27976937fb6a931b3ed2d40aebd76a26
Content-Type: text/plain; charset = "windows-1255"
Content-Transfer-Encoding: 8bit

×*יסיון עברית

--b1_27976937fb6a931b3ed2d40aebd76a26
Content-Type: text/html; charset = "windows-1255"
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"<html>
<head>

<META HTTP-EQUIV="Content-Type" content="text/html;
charset=windows-1255"</head<body<p dir=RTL><span
lang=HE>&#1513;&#1500;&#1493;&#1501;&nbsp;&#1495;&#1489;&#1512;&#1514;
Tour4less contact .</span></p<p dir=RTL><span
lang=HE>&#1502;&#1513;&#1514;&#1502;&#1513; &#1513;&#1500;
&#1492;&#1488;&#1514;&#1512; &#1513;&#1500;&#1504;&#1493; </span><span
dir=LTR>TOUR4LESS.CO.IL</span><span dir=RTL></span><span lang=HE><span
dir=RTL></span&#1492;&#1514;&#1506;&#1504;&#1497;&#1497;&#1503;
&#1489;&#1497;&#1510;&#1497;&#1512;&#1514; &#1511;&#1513;&#1512;
&#1488;&#1497;&#1514;&#1493; &#1506;&quot;&#1497;.........

View Replies !
Extract The Information By Converting The Binary File To Plain Text
I tried to extract the information by converting the binary file to plain text but I couldn't find any defining characteristics which I could use to extract the information. After looking around to see if anyone else had managed to accomplish this I found that the Freetype library has functions which can access the information I want, specifically TT_Get_Name_ID and TT_Get_Name_String. However I can't figure out how to access these functions from PHP (even though I have freetype installed with GD) or how to convert the code to php.

View Replies !
Working With Plain Text Passwords In Shell/telnet Script
I've got a crafty script that uses a really nice little php telnet class to feed commands via telnet to a remote application. Part of the script, however, is logging in: once to the remote unix host, x-times into submodules of the application itself.

What is the best way to store these passwords so that at the time of execution, they're transmittable as plain text but so they're not easily retrieved via code source, db view, or external file view?

View Replies !
Sending Mail: Choice Between Sending Receipt, Or HTML Formatting
I'm using PHP's mail function to send out a message via email.

I would like for this email message to send a receipt when read as well as send an HTML formatted email. Both aspects are important to me.

I know this is a product of the mail header. This is the format I currently have:

mail(to, subject, body, "From: name <email>
Disposition-Notification-To: name<email>
Content-type:text/html;charset=utf-8");

This prompts the email program to send a reciept, but the email message is not in the HTML format, and even contains "Content-type:text/html;charset=utf-8" at the top of the body.

If I switch the order to this format:

mail(to, subject, body, "From: name <email>
Content-type:text/html;charset=utf-8
Disposition-Notification-To: name<email>");

This sends the email with HTML formatting but does not prompt the sending of the receipt. I also get "Disposition-Notification-To: name<email>" at the top of the email message.

This tells me there is a problem in the transition between the headers, which currently is "".

What am I doing wrong?

View Replies !
Hiding The Receipeint Email Address While Sending Email
i am sending an email using php. i dont want the receipeints to see the to address. the problem is i am sending to a mailing list email address. so how can i hide the to address and the from address if possible?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved