Page 1 of 1

MAIL (Message/Body) problem

Posted: Wed Nov 01, 2006 11:29 pm
by madhu
Dear All,

Am facing a small problem.Please help me.

Am doing a task in that am trying to send mails.

In that if i type any link in the textarea of message/body , after sending mail, the link is not activating.

is there any way to enable the hyperlink while using mail() function??

Waiting for your valuable replies....

Thanks and regards
MADHU

Posted: Thu Nov 02, 2006 12:00 am
by aaronhall
Just add anchor tags around the link, e.g. <a href="http://mysite.com/asdf.php">my link</a>

Posted: Thu Nov 02, 2006 4:44 am
by madhu
Dear All,

This is the code am using to send mail.

Now the problem is when i sent a mail with HTML content like(http://mail.yahoo.com) , then after sending mail, am not able to recognise as a link.

Before using mail() function, am getting that $message (which contains the content) as link.

But when i sent a mail using mail() function , am not getting that link.

May be problem is with Content-type: text/html.

Other than this link, remaining any HTML tags am able to recognise.

Please guide me where i did mistake...

Code: Select all

$headers  = "MIME-Version: 1.0\r\n";
   $headers .= "Content-type: text/html; charset=ISO-8859-1;\r\n";
   //$headers .= "Content-type: text/plain; charset=ISO-8859-1;\r\n";

             if(mail($toid, $subject, $message, $from.$headers))
                {
                 echo "<div align=\"center\"><strong>Mail sent successfully.....</strong></div>";
                }
Waiting for your valuable replies....

Thanks and regards
MADHU

Posted: Thu Nov 02, 2006 7:34 am
by Chris Corbyn

Code: Select all

$from.$headers
Where's $from and how is it defined? I'm going to guess it's breaking your headers.

Posted: Thu Nov 02, 2006 8:11 am
by madhu

Code: Select all

$from = "From: $fromid<$fromtext>\r\n";
$fromid -- name of the person from which mail is going to send
$fromtext --- mailid of the person from which mail is going to send.

Posted: Thu Nov 02, 2006 8:15 am
by madhu
i checked by replacing $from.$headers by $headers, then also it is not working

Posted: Thu Nov 02, 2006 10:03 am
by Chris Corbyn
Hmm...

Try

Code: Select all

$headers  = "MIME-Version: 1.0\r\n";
   $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
Changed:

Content-type --> Content-Type
Charset value quoted with ".."
Charset value lowercased (really shouldn't matter)
Trailing ; removed

How many mail clients have you tried this in?

Posted: Sun Nov 05, 2006 12:27 am
by madhu
Hi All,

I tried like this.

Code: Select all

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: [b]text/html[/b]; charset=iso-8859-1' . "\r\n";



if(mail($toid, $subject, $message, $from.$headers))
                {
                 echo "<div align=\"center\"><strong>Mail sent to the users in $filename successfully.....</strong></div>";
                }

In this $toid,$subject, $message and $from will come from textboxes.

Now my problem is if message contains any Links(href),then in mail that link is not coming.....

Please suggest me....

Am searching from last 3 days in Google......

Waiting for your valuable replies...

Thanks and regards
MADHU

Posted: Sun Nov 05, 2006 1:38 am
by madhu
Hi all....

Code: Select all

$headers  = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: [b]text/html[/b]; charset=iso-8859-1' . "\r\n"; 



if(mail($toid, $subject, $message, $from.$headers)) 
                { 
                 echo "<div align=\"center\"><strong>Mail sent to the users in $filename successfully.....</strong></div>"; 

              echo $message; //here also am getting the content with correct format(i.e with href)
                }

Please help me what is the problem....

Thanks and regards
MADHU

Posted: Sun Nov 05, 2006 3:23 am
by satheshf12000
Try in this way:

Code: Select all

$eol = "\r\n";
$mailheader  = 'MIME-Version: 1.0' . $eol;
$mailheader .= 'Content-type: text/html; charset=iso-8859-1' . $eol;
$mailheader .= "From: XXX Mail Services<mailer@xxxxxx.com>". $eol;
$mailheader .= 'Return-Path: Madhu <no-reply@xxxxxx.com>'.$eol;    // this to set reply address.

mail($to,$subject,$msg,$mailheader);

Posted: Sun Nov 05, 2006 3:35 am
by madhu
hi satheshf12000,

you replaced "\r\n" with $eol .

i think what i implemented and your code both are same.

Posted: Sun Nov 05, 2006 3:59 am
by satheshf12000
what are you sending in the $msg ??

Posted: Sun Nov 05, 2006 4:06 am
by madhu
$msg contains any content.

Example:

if i type http://mail.yahoo.com , then after sending mail am not able to get that as link(i.e href).

It is coming as a plain text in the mail Inbox.

Posted: Sun Nov 05, 2006 4:33 am
by Chris Corbyn
You're going to need to show us more code. Namely, the bit that generates $msg.