Re: [PHP] Cannot send a hyperlink

This is a discussion on Re: [PHP] Cannot send a hyperlink within the PHP General forums, part of the PHP Programming Forums category; Brad wrote: > Beginning with > $headers .= "--".$htmlalt_mime_boundary.$eol; > It starts to read it as text and ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-15-2007
Stut
 
Posts: n/a
Default Re: [PHP] Cannot send a hyperlink

Brad wrote:
> Beginning with
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> It starts to read it as text and not html??
>
> Could this be a server side problem?
>
> $email = $_REQUEST['email'] ;
> $fromaddress .= 'admin@zoneofsuccessclub.com';
> $fromname .= 'Zone of success Club';
> $eol="\r\n";
> $headers = "From: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
> $headers .= "X-Mailer: PHP ".phpversion().$eol;
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n";
> mail($email, $subject, $body, $headers);


You should not have a mime boundary in your headers. Why not use
PHPMailer? All this (apparently) complicated stuff is already
implemented for you. Either that or spend a few days learning about the
structure of emails by following the links Daniel Brown sent you a few
emails ago.

PHPMailer can be found here: http://phpmailer.sf.net/

-Stut

--
http://stut.net/

> -----Original Message-----
> From: Daniel Brown [mailto:parasane@gmail.com]
> Sent: Wednesday, November 14, 2007 11:09 AM
> To: Brad
> Cc: admin@buskirkgraphics.com; php-general@lists.php.net
> Subject: Re: [php] Cannot send a hyperlink
>
> Brad,
>
> That code is a mess and highly incorrect, even at a novice level.
> Let me give you a hand....
>
> On Nov 14, 2007 10:31 AM, Brad <brads@ftnco.com> wrote:
>> I implemented the proposed code, and emails are not being sent?
>>
>> Any suggestions?
>>
>> Here is the code
>>
>> <?
>>
>> $email = $_REQUEST['email'] ;
>> $eol="\r\n";
>> $headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
>> $headers .= "X-Mailer: PHP ".phpversion().$eol;
>> $msg .= "--".$htmlalt_mime_boundary.$eol;
>> $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
>> $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
>> $body.='<ahref="'.www.zoneofsuccessclub.com.'">lin k </a>';
>> $msg .= $body.$eol.$eol;
>> mail($to, $subject, $msg, $headers);
>>
>> ?>

>
> [snip]
>
> 1.) You reference $to in the mail() function, but there is no $to
> defined. Instead, either change $email to $to or vice-versa.
> 2.) You don't need to start the first line of a variable off with
> a .= --- this will append to an existing variable of the same name, if
> it exists.
> 3.) You change your quoting style where it's not necessary. All
> $msg lines should be using double quotes in your code above.
> 4.) <ahref="..." is not a tag. The correct usage is <a href="..."
> 5.) You have things in the message body that should be in the headers.
> 6.) You don't need to do a carriage return and newline in the
> message body. A simple \n will suffice.
> 7.) I'm not sure what you hoped to achieve with the
> "'.www.domain.com.'" conglomerate, but.... don't. That makes PHP
> think that the domain is some sort of internally-defined variable of
> horrible construct.
> 8.) You should use http:// prior to the FQDN.
>
> Taking hints from what appears to be your code, this is how it should
> be:
> <?
> $email = $_REQUEST['email'] ;
> $eol="\r\n";
> $headers = "From: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
> $headers .= "X-Mailer: PHP ".phpversion().$eol;
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n";
> mail($email, $subject, $body, $headers);
> ?>
>
> Prior to asking a bunch of questions on the list, which seriously
> puts you at risk for being flamed or ignored, check out these
> references:
> http://www.bath.ac.uk/bucs/email/anatomy.shtml [Anatomy of an
> Email Message]
> http://www.php.net/mail [PHP Mail Functions]
> http://www.htmlgoodies.com/primers/html/ [Beginner's Guide to HTML]
>

Reply With Quote
  #2 (permalink)  
Old 11-15-2007
Brad
 
Posts: n/a
Default RE: [PHP] Cannot send a hyperlink

No access to the server command line to install it!
And, I am into this guy too deep to switch technologies. For the next time
around, no problem, this time I am just trying to get php to do what it is
supposed to do.

The suggestion of mime was presented to me from another kind sole trying to
help that knows more than I and recommended on other help files.

Why is php refusing to parse as html?

-----Original Message-----
From: Stut [mailto:stuttle@gmail.com]
Sent: Thursday, November 15, 2007 9:46 AM
To: Brad
Cc: 'Daniel Brown'; php-general@lists.php.net
Subject: Re: [php] Cannot send a hyperlink

Brad wrote:
> Beginning with
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> It starts to read it as text and not html??
>
> Could this be a server side problem?
>
> $email = $_REQUEST['email'] ;
> $fromaddress .= 'admin@zoneofsuccessclub.com';
> $fromname .= 'Zone of success Club';
> $eol="\r\n";
> $headers = "From: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
> $headers .= "X-Mailer: PHP ".phpversion().$eol;
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n";
> mail($email, $subject, $body, $headers);


You should not have a mime boundary in your headers. Why not use
PHPMailer? All this (apparently) complicated stuff is already
implemented for you. Either that or spend a few days learning about the
structure of emails by following the links Daniel Brown sent you a few
emails ago.

PHPMailer can be found here: http://phpmailer.sf.net/

-Stut

--
http://stut.net/

> -----Original Message-----
> From: Daniel Brown [mailto:parasane@gmail.com]
> Sent: Wednesday, November 14, 2007 11:09 AM
> To: Brad
> Cc: admin@buskirkgraphics.com; php-general@lists.php.net
> Subject: Re: [php] Cannot send a hyperlink
>
> Brad,
>
> That code is a mess and highly incorrect, even at a novice level.
> Let me give you a hand....
>
> On Nov 14, 2007 10:31 AM, Brad <brads@ftnco.com> wrote:
>> I implemented the proposed code, and emails are not being sent?
>>
>> Any suggestions?
>>
>> Here is the code
>>
>> <?
>>
>> $email = $_REQUEST['email'] ;
>> $eol="\r\n";
>> $headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
>> $headers .= "X-Mailer: PHP ".phpversion().$eol;
>> $msg .= "--".$htmlalt_mime_boundary.$eol;
>> $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
>> $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
>> $body.='<ahref="'.www.zoneofsuccessclub.com.'">lin k </a>';
>> $msg .= $body.$eol.$eol;
>> mail($to, $subject, $msg, $headers);
>>
>> ?>

>
> [snip]
>
> 1.) You reference $to in the mail() function, but there is no $to
> defined. Instead, either change $email to $to or vice-versa.
> 2.) You don't need to start the first line of a variable off with
> a .= --- this will append to an existing variable of the same name, if
> it exists.
> 3.) You change your quoting style where it's not necessary. All
> $msg lines should be using double quotes in your code above.
> 4.) <ahref="..." is not a tag. The correct usage is <a href="..."
> 5.) You have things in the message body that should be in the headers.
> 6.) You don't need to do a carriage return and newline in the
> message body. A simple \n will suffice.
> 7.) I'm not sure what you hoped to achieve with the
> "'.www.domain.com.'" conglomerate, but.... don't. That makes PHP
> think that the domain is some sort of internally-defined variable of
> horrible construct.
> 8.) You should use http:// prior to the FQDN.
>
> Taking hints from what appears to be your code, this is how it should
> be:
> <?
> $email = $_REQUEST['email'] ;
> $eol="\r\n";
> $headers = "From: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
> $headers .= "X-Mailer: PHP ".phpversion().$eol;
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n";
> mail($email, $subject, $body, $headers);
> ?>
>
> Prior to asking a bunch of questions on the list, which seriously
> puts you at risk for being flamed or ignored, check out these
> references:
> http://www.bath.ac.uk/bucs/email/anatomy.shtml [Anatomy of an
> Email Message]
> http://www.php.net/mail [PHP Mail Functions]
> http://www.htmlgoodies.com/primers/html/ [Beginner's Guide to HTML]
>


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.32/1131 - Release Date: 11/14/2007
4:54 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.32/1131 - Release Date: 11/14/2007
4:54 PM

Reply With Quote
  #3 (permalink)  
Old 11-15-2007
Brad
 
Posts: n/a
Default RE: [PHP] Cannot send a hyperlink

My bad,
You do not need command line access!
I should have read more.

I just need to get this puppy working is all.
Php should be able to do this by it's self!

-----Original Message-----
From: Stut [mailto:stuttle@gmail.com]
Sent: Thursday, November 15, 2007 9:46 AM
To: Brad
Cc: 'Daniel Brown'; php-general@lists.php.net
Subject: Re: [php] Cannot send a hyperlink

Brad wrote:
> Beginning with
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> It starts to read it as text and not html??
>
> Could this be a server side problem?
>
> $email = $_REQUEST['email'] ;
> $fromaddress .= 'admin@zoneofsuccessclub.com';
> $fromname .= 'Zone of success Club';
> $eol="\r\n";
> $headers = "From: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
> $headers .= "X-Mailer: PHP ".phpversion().$eol;
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n";
> mail($email, $subject, $body, $headers);


You should not have a mime boundary in your headers. Why not use
PHPMailer? All this (apparently) complicated stuff is already
implemented for you. Either that or spend a few days learning about the
structure of emails by following the links Daniel Brown sent you a few
emails ago.

PHPMailer can be found here: http://phpmailer.sf.net/

-Stut

--
http://stut.net/

> -----Original Message-----
> From: Daniel Brown [mailto:parasane@gmail.com]
> Sent: Wednesday, November 14, 2007 11:09 AM
> To: Brad
> Cc: admin@buskirkgraphics.com; php-general@lists.php.net
> Subject: Re: [php] Cannot send a hyperlink
>
> Brad,
>
> That code is a mess and highly incorrect, even at a novice level.
> Let me give you a hand....
>
> On Nov 14, 2007 10:31 AM, Brad <brads@ftnco.com> wrote:
>> I implemented the proposed code, and emails are not being sent?
>>
>> Any suggestions?
>>
>> Here is the code
>>
>> <?
>>
>> $email = $_REQUEST['email'] ;
>> $eol="\r\n";
>> $headers .= "From: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
>> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
>> $headers .= "X-Mailer: PHP ".phpversion().$eol;
>> $msg .= "--".$htmlalt_mime_boundary.$eol;
>> $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
>> $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
>> $body.='<ahref="'.www.zoneofsuccessclub.com.'">lin k </a>';
>> $msg .= $body.$eol.$eol;
>> mail($to, $subject, $msg, $headers);
>>
>> ?>

>
> [snip]
>
> 1.) You reference $to in the mail() function, but there is no $to
> defined. Instead, either change $email to $to or vice-versa.
> 2.) You don't need to start the first line of a variable off with
> a .= --- this will append to an existing variable of the same name, if
> it exists.
> 3.) You change your quoting style where it's not necessary. All
> $msg lines should be using double quotes in your code above.
> 4.) <ahref="..." is not a tag. The correct usage is <a href="..."
> 5.) You have things in the message body that should be in the headers.
> 6.) You don't need to do a carriage return and newline in the
> message body. A simple \n will suffice.
> 7.) I'm not sure what you hoped to achieve with the
> "'.www.domain.com.'" conglomerate, but.... don't. That makes PHP
> think that the domain is some sort of internally-defined variable of
> horrible construct.
> 8.) You should use http:// prior to the FQDN.
>
> Taking hints from what appears to be your code, this is how it should
> be:
> <?
> $email = $_REQUEST['email'] ;
> $eol="\r\n";
> $headers = "From: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol;
> $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol;
> $headers .= "X-Mailer: PHP ".phpversion().$eol;
> $headers .= "--".$htmlalt_mime_boundary.$eol;
> $headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
> $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
> $body = "<a href=\"http://www.zoneofsuccessclub.com\">link </a>\n";
> mail($email, $subject, $body, $headers);
> ?>
>
> Prior to asking a bunch of questions on the list, which seriously
> puts you at risk for being flamed or ignored, check out these
> references:
> http://www.bath.ac.uk/bucs/email/anatomy.shtml [Anatomy of an
> Email Message]
> http://www.php.net/mail [PHP Mail Functions]
> http://www.htmlgoodies.com/primers/html/ [Beginner's Guide to HTML]
>


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.32/1131 - Release Date: 11/14/2007
4:54 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.32/1131 - Release Date: 11/14/2007
4:54 PM

Reply With Quote
  #4 (permalink)  
Old 11-15-2007
Instruct ICC
 
Posts: n/a
Default RE: [PHP] Cannot send a hyperlink


> No access to the server command line to install it!
> And, I am into this guy too deep to switch technologies. For the next time
> around, no problem, this time I am just trying to get php to do what it is
> supposed to do.


[sarcastic]Rough install.[/sarcastic] If you can write a php script, you can use PHPmailer http://phpmailer.sourceforge.net/tutorial.php#4


<?php



require("class.phpmailer.php");



$mail = new PHPMailer();



$mail->IsSMTP(); // telling the class to use SMTP

$mail->Host = "smtp.example.com"; // SMTP server



$mail->From = "from@example.com";

$mail->AddAddress("myfriend@example.net");



$mail->Subject = "An HTML Message";

$mail->Body = "Hello, <b>my friend</b>! \n\n This message uses HTML entities!";



?>

__________________________________________________ _______________
Windows Live Hotmail and Microsoft Office Outlook – together at last. *Get it now.
http://office.microsoft.com/en-us/ou...CL100626971033
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0