Jump to content

Trying to leverage file_get_contents (Help)


Chezshire

Recommended Posts

Hi Everyone,

  I recently learned about the 'file_get_contents' function here at phpFreaks (thank you) and I am now trying to use that automate all my email scripts. It's working in most of them, however this one is not am I am unsure of why.

 

I tried it like this:

 

//Gets address as a string from text file - one place to update all addresses
  $emailAddresses = file_get_contents("_modEmailAddresses.txt");
  $to = $emailAddresses;
  
//if (!$APPROVED && !$id) { mail($emailAddresses, "[$siteName] New Player", "A new member has submitted a profile to the $siteName website.\n\nName: $NAME\nUsername: $USERNAME\n\nVisit this URL to approve the member:\nhttp://www.xaviers-children.net/home.php", "Return-Path: xaviers-children <[email protected]>\nErrors-To: xaviers-children.net <[email protected]>\nFrom: xaviers-children <[email protected]>\nReply-To: xaviers-children.net <[email protected]>\nX-Mailer: PHP/" . phpversion()); }

 

This did not work, so I tried changing the third line variable from '$email' to '$mail' as show below, this also did not work.

//Gets address as a string from text file - one place to update all addresses
  $emailAddresses = file_get_contents("_modEmailAddresses.txt");
  $mail = $emailAddresses;
  
if (!$APPROVED && !$id) { mail($emailAddresses, "[$siteName] New Player", "A new member has submitted a profile to the $siteName website.\n\nName: $NAME\nUsername: $USERNAME\n\nVisit this URL to approve the member:\nhttp://www.xaviers-children.net/home.php", "Return-Path: xaviers-children <[email protected]>\nErrors-To: xaviers-children.net <[email protected]>\nFrom: xaviers-children <[email protected]>\nReply-To: xaviers-children.net <[email protected]>\nX-Mailer: PHP/" . phpversion()); }

 

I feel that I'm very close, and that my problem is just staring me right in the face and I can't see it -- any help would be greatly appreciated.

 

Thank you very much

-chez

I just attempted to revise third line like so and received a parsing/t-string errors. I am a complete newb who is over his head.

 


if (!$APPROVED && !$id) { mail = $emailAddresses("[$siteName] New Player",

 

This didn't work either. Any suggestions are appreciated. I think that i'm close - this will, if i can get it to work make my life so much easier.

thanks

 

I went and read up some more on the mail() function, and thought that perhaps what I was doing work if i put the $emailAddresses and $to directly inside the mail call (I dont' think i'm using the termis correctly-sorry still learning) - please see example below for what else did not work - it produced an error

 


if (!$APPROVED && !$id) { mail(
//Gets address as a string from text file - one place to update all addresses
  $emailAddresses = file_get_contents("_modEmailAddresses.txt");
  $to = $emailAddresses;

$emailAddresses, "[$siteName] New Player", "A new member has submitted a profile to the $siteName website.\n\nName: $NAME\nUsername: $USERNAME\n\nVisit this URL to approve the member:\nhttp://www.xaviers-children.net/home.php", "Return-Path: xaviers-children <[email protected]>\nErrors-To: xaviers-children.net <[email protected]>\nFrom: xaviers-children <[email protected]>\nReply-To: xaviers-children.net <[email protected]>\nX-Mailer: PHP/" . phpversion()); }

 

Still scratching my head on this one.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.