Jump to content

Newletter image header


ayok

Recommended Posts

Hi.. I'm a newbie here, also to PHP.

NOw I have a question about php newsletter. I have a simple newsletter script which use .txt database.for the emails. Everything works fine.

 

However, I want an image header on the mail body.. like logo. So everytime I send my newsletter, the image will appear on the top of the mail body. But I can't get it. Could anybody tell me how to do it? Here is part of the php script for the email.

<?php
include "config.php";
include "header.inc";
if(!($sendmail)){
?>

<form method="POST" action="<?php echo($PHP_SELF); ?>">

<h3>News </h3>
  <p>Select Mailing List:<br>
  <select size="1" name="list_choice">
    <option selected>emails.txt</option>
    
  </select></p>
  <p>Title:<br>
  <input type="text" name="subject_choice" size="50"></p>
  <p>Message:<br>
  <textarea rows="6" name="message_choice" cols="42"></textarea></p>
  <p><input type="submit" value="Send Mail" name="sendmail"><input type="reset" value="Reset" name="B2"></p>
</form>
</UL>
<?php
}
$header = "From: $from_mail; \n";
if ($sendmail == "Send Mail"){

print ("<H3>Sending news to emails...</H3><P>");

$file_handle = fopen($list_choice, "r") or die("Couldn't open mailing list..");

while (!feof($file_handle)) {
set_time_limit(0);
$address = fgets($file_handle, 1024);

mail("$address", stripslashes($subject_choice), 
stripslashes($message_choice), $header);
print ("Mail Sent To: $address<br>\n");

}
print ("<H3>Done! The news is sent.  Klik <A HREF='view.php'>Click here</A> to see the emails.</H3><BR>");
}
include "footer.inc";
?>

Link to comment
Share on other sites

Thanks Greaser!

yes, $message_choice will be the body. The message will be filled in a news form, and sent directly without being saved to any database.

 

I think that is my question, how can i include the picture into the $message_choice file? I got this script from a php tut, but they don't discuss about include the picture.

 

Thx.

ayoksus

Link to comment
Share on other sites

Since your $message file is php you can use html in that file. If your not that familiar with html the following code is what you will need to display that picture:

<img src="Action" width="width_in_pixels" height="height_in_pixels">

Where it says action you need to input the location that you picture is located such as "yoursitename.com/images"

Then all you need to do is place the code I gave you wherever you want the picture to be in your $message file--possibly the header since you said at the top.

 

Link to comment
Share on other sites

<?php
include "config.php";
include "header.inc";
if(!($sendmail)){
?>

<form method="POST" action="<?php echo($PHP_SELF); ?>">

<h3>News </h3>
  <p>Select Mailing List:<br>
  <select size="1" name="list_choice">
    <option selected>emails.txt</option>
    
  </select></p>
  <p>Title:<br>
  <input type="text" name="subject_choice" size="50"></p>
  <p>Message:<br>
  <textarea rows="6" name="message_choice" cols="42"></textarea></p>
  <p><input type="submit" value="Send Mail" name="sendmail"><input type="reset" value="Reset" name="B2"></p>
</form>
</UL>
<?php
}
$headers = "From: server@barnyard.com\r\n" .
       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       "MIME-Version: 1.0\r\n" .
       "Content-Type: text/html; charset=utf-8\r\n" .
       "Content-Transfer-Encoding: 8bit\r\n\r\n";
       
if ($sendmail == "Send Mail"){

print ("<H3>Sending news to emails...</H3><P>");

$file_handle = fopen($list_choice, "r") or die("Couldn't open mailing list..");

while (!feof($file_handle)) {
set_time_limit(0);
$address = fgets($file_handle, 1024);

mail("$address", stripslashes($subject_choice), 
stripslashes($message_choice), $headers);
print ("Mail Sent To: $address<br>\n");

}
print ("<img src='http://www.what_ever.com/image.gif'></img><br>


<H3>Done! The news is sent.  Klik <A HREF='view.php'>Click here</A> to see the emails.</H3><BR>");
}
include "footer.inc";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.