Jump to content
MakeWebGames

E-mail users help


Recommended Posts

below is a e-mail form, the form sends e-mails fine and good but i cant get the html stuff to work in the e-mail, the section in question is in //====== //=======

Can i have some help.

I want the image and links to work in an e-mail,

Can anyone help

 

<?php
require "globals.php";
global $c;
print "<html>
<head>
<title>Infamous Wars</title>
</head>
<body><center>";
$tt=mysql_query("SELECT * FROM users",$c) or die(mysql_error());
while($gh=mysql_fetch_array($tt))
{
$to = $gh['email'];
$subject = "Infamous Wars";
$headers = "From: Infamous Wars Staff";
$body = "

//======
<center><img src=http://www.xxxxxx.com/images/title.png></center>
<br/>
<br/>
Hello {$gh['username']}! 
Test
<br/><br/><br/>
Please Do NOT Reply to this E-mail<br/>
If you Want to Reply Please Login via <a href=http://www.xxxxxx.com>HERE</a><br/>

//======
";
mail($to, $subject, $body, $headers);
print "Email sent to {$gh['username']}!<br />";
}
?>
Edited by peterisgb
Link to comment
Share on other sites

well after i tried them and when it e-mails me and doesn't work i put it back to default so i only have the above code now.

 

is it really that complicated to add?

 

<?php
require "globals.php";

$tt=mysql_query("SELECT * FROM users",$c) or die(mysql_error());
while($gh=mysql_fetch_array($tt))
{
   $to = ''.$gh['email'].'';
   $subject = 'Infamous Wars';
   $headers = "From: Infamous Wars Staff\r\n";
   $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
   $message = "<img src='http://yourgame/logo.png' alt='' />";
   $message .= "Hello ".$gh['username']." ! <br />Test <br />
   Please Do NOT Reply to this E-mail
   If you Want to Reply Please Login via <a href='http://www.yourgame.com'>HERE</a>";
mail($to, $subject, $message, $headers) or die ("Failure");
print "Email sent to {$gh['username']}!";
}
?>
Edited by lucky3809
Tested and fixed the code... fully works
Link to comment
Share on other sites

nope, running it on the server and that code failed.

It should have never failed did you check your spam folder???

I personally tested it and it mailed everyone in the database....

You may need someone to manually install it for you, your not doing something right on the page your putting it in...

dont add that other stuff to it:

print "<html>

<head>

<title>Infamous Wars</title>

</head>

<body><center>";

If you want it to say your game name just add:

print "<title>Infamous Wars</title>";

Other wise it will NOT send your image.

Link to comment
Share on other sites

well for me the whole lot just comes up as codes in the e-mail in my inbox

 

<center><img src=http://www.xxxxxx.com/images/title.png></center>
Hello username!
Test
Please Do NOT Reply to this E-mail
If you Want to Reply Please Login via <a href=http://www.xxxxxx.com>HERE</a>
Link to comment
Share on other sites

well for me the whole lot just comes up as codes in the e-mail in my inbox

 

<center><img src=http://www.xxxxxx.com/images/title.png></center>
Hello username!
Test
Please Do NOT Reply to this E-mail
If you Want to Reply Please Login via <a href=http://www.xxxxxx.com>HERE</a>

 

post the WHOLE page you have it on,,, you have body,html tags somewhere they shouldnt be that is making it not come up but rather the tags themselves.

Test my script it works, just make a file call it mail.php and add the code, then go to that page in url then check you mail. you will see the code works... Dont add anything to what I posted in the test page. However add your game pic url where it goes.

Edited by lucky3809
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...