tech-php Posted April 20, 2007 Share Posted April 20, 2007 Hey there all ! I want to execute php script in the body of an email.. Is there any specific content type to be include in header ? like.. include "www.xyz.com"; >> i want this line to be executed inside email $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail("[email protected]",$subject,$body,$headers); ----------------------------------------------------------------------------- I tried .. $body = "include \"www.xyz.com\";" ; But it displays........ include "www.xyz.com" ; .......inside the mail Can anyone Help? Tanks in advance Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/ Share on other sites More sharing options...
HaLo2FrEeEk Posted April 20, 2007 Share Posted April 20, 2007 Try using either cURL or the snoopy library to get the contents of the page you are trying to send, then send it. Google the snoopy Library for information on how to use it, it is SO simple, much more so than cURL. Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-233801 Share on other sites More sharing options...
genericnumber1 Posted April 20, 2007 Share Posted April 20, 2007 cURL isn't simple, but it's powerful but in his case he could just use file_get_contents() Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-233805 Share on other sites More sharing options...
tech-php Posted April 20, 2007 Author Share Posted April 20, 2007 Hey .. thanks... But cURL works when i run php file... but it doesnt work inside mail funstion... i'm not being able to the php code in mail(); Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-233855 Share on other sites More sharing options...
neel_basu Posted April 20, 2007 Share Posted April 20, 2007 First Clarify. Are you trying to send a mail to a User that contains DYNAMIC Content ?? Yor mail can containn php codes as texts. But it can not get executed by the User's email server/ Cliant when he reads the mail. Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-234189 Share on other sites More sharing options...
tech-php Posted April 20, 2007 Author Share Posted April 20, 2007 I want to display a site directly inside emails body.. Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-234191 Share on other sites More sharing options...
per1os Posted April 20, 2007 Share Posted April 20, 2007 <?php $body = file_get_contents("http://www.xyz.com"); // i want this line to be executed inside email $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail("[email protected]",$subject,$body,$headers); ?> Try that. Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-234197 Share on other sites More sharing options...
neel_basu Posted April 20, 2007 Share Posted April 20, 2007 Send HTML MIME Mails and in that HTML mail use a frame/ iframe that will point to your php page. To send HTML MIMI Mail You can use this class http://zigmoyd.sourceforge.net/man/mail.phpJust make a email body that contains HTML tags (e.g. frameset or iframe). and it will set its MIME Type to text/plain automatically. Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-234202 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 20, 2007 Share Posted April 20, 2007 Or, you could do what I said in the first place, and use cURL or the snoopy library (which is cURL, but simplifies it) and save the contents of the page as $body, then make $body the body of your email, just like I said. Don't execute the cURL in the email, get the page code, then send it as HTML. Link to comment https://forums.phpfreaks.com/topic/47847-php-mail-function/#findComment-234274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.