Forum Moderators: coopster

Message Too Old, No Replies

only plain text phpmailer

         

helenp

1:35 pm on Jun 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi, I have installed phpmailer v. 2.0.0
It works perfect, but I donīt like that I receive the emails as html, I would prefer to receive them as plain text. I have tried to change the configuration, but It dont work.

This is in the php page where the form is:
$mail->IsHTML(true);
I tried changing it to false but keep receiving as html.
This is on the include class.phpmailer.php

function IsHTML($bool) {
if($bool == true) {
$this->ContentType = 'text/html';
} else {
$this->ContentType = 'text/plain';
}
}
I tried to change both to text/plain, and nothing either.
Also this can be found in class.phpmailer.php

$this->IsHTML(true);
$this->Body = $message;
$textMsg = trim(strip_tags($message));
if ( !empty($textMsg) && empty($this->AltBody) ) {
$this->AltBody = $textMsg;
}
if ( empty($this->AltBody) ) {
$this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
}
}
and these comments:
/**
* Sets the Body of the message. This can be either an HTML or text body.
* If HTML then run IsHTML(true).
* @var string
*/
var $Body = '';

/**
* Sets the text-only body of the message. This automatically sets the
* email to multipart/alternative. This body can be read by mail
* clients that do not have HTML email capability such as mutt. Clients
* that can read HTML will view the normal Body.
* @var string
*/
var $AltBody


I suppose there is a way to change the configuration, but I canīt figure out how.
Thanks in advance.
Helena

eelixduppy

1:04 am on Jun 12, 2008 (gmt 0)



Try changing this line:

$this->IsHTML(true);

To the following:


$this->IsHTML(FALSE);

See if that helps :)

helenp

7:19 am on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No, thanks,
That donīt work either.
Donīt understand, should be a way.

dreamcatcher

8:19 am on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I wonder if its a setting in your mail program? Did you try sending to another mail account? If you altered the isHTML function to always return 'text/plain', its strange it should come through as HTML.

The other possibility is a mailer bug. Have you contacted the developers? Do they have a support forum?

dc

helenp

11:41 am on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks dreamcatcher,
I do not think is is my email program though normally I receive plain text emails.
I just asked in their forum, lets see if any luck.
Even though there are not many posting there.

dreamcatcher

12:47 pm on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The mailer project passed hands awhile back and now has new developers. If you get no joy there, try Google Groups.

dc

eelixduppy

2:52 pm on Jun 12, 2008 (gmt 0)



Search all of the files associated with the mailer for Content-Type, or something similar, to see where else the content type is being changed. There is something wrong here.

Also, sorry for my previous response; I wasn't really paying attention and my answer wasn't anything helpful.

helenp

3:53 pm on Jun 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



eelixduppy,
I did a search for ContentType and in class.phpmailer.php there were some:
/**
* Sets the Content-type of the message.
* @var string
*/
var $ContentType = 'text/plain';

switch($this->message_type) {
case 'plain':
$result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
$result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
break;

if($this->InlineImageExists()){
$result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
} else {
$result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');

case 'alt':
$result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
$result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
break;
}

$result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);

$result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);

$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);

return ( ! isset($mimes[strtolower($ext)])) ? 'application/x-unknown-content-type' : $mimes[strtolower($ext)];

I do not see anything to change there to try....

helenp

10:14 am on Jun 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Lol,
In another forum they helped,
was stupid, you had to eliminate the AltBody as well to make it work, so works now.