473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

NEWSLETTER in php

Dear sir,
I want NEWSLETTER in PHP i send newsletter in HTM page how to send pleas can u help any one.

Regards
A. Jaya prakash
Aug 7 '09 #1
12 3274
Dear sir,
I want NEWSLETTER in PHP i send newsletter in HTM page how to send pleas can u help any one.

Regards
A. Jaya prakash
Aug 7 '09 #2
i have working simple newsletter paths is http://aidindia.com/mailer/ but not working
Aug 7 '09 #3
Dormilich
8,658 Expert Mod 8TB
I use a simple newsletter based on SwiftMailer, but there should be lots of sample scripts around (google)
Aug 7 '09 #4
thanks for your reply

I am working in php new i didn't coading but i want send my website to goto html page all mails how to send i will send here my working pages

http://www.aidindia.org.uk/mailer/sendmail.html

pleas help any newslette sent to html file subribers full coading i want

Regards
A. Jaya prakash
Aug 7 '09 #5
dlite922
1,584 Expert 1GB
@aajayaprakash
You won't get it here buddy. Try the next forum.




Dan
Aug 7 '09 #6
dear sir i want newsletter no database in PHP if u have send me my mail adddress <email removed>
Aug 10 '09 #7
Dormilich
8,658 Expert Mod 8TB
I have not, but google has.
Aug 10 '09 #8
MrMancunian
569 Expert 512MB
Listen aajayaprakash, we are not going to send you anything. If you want someone to make you a script, you can hire someone. We're all volunteers around here and if I want someone barking at me that I should write something, I'll just listen to my boss.

Now, you've got two options. You can either try to start writing something yourself and ask us if you're stuck on something, or you can try another forum or article library on the internet. It's you're choice, but stop asking us for full code.

Steven
Aug 10 '09 #9
Thanks for reply

I have given coad but not working wnat can i do pleas sugustion soon


newsletter.php

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=big5" />
  5. <title>Send Newsletter System (SNS)</title>
  6.  
  7. <script language="JavaScript" type="text/javascript"><!--
  8. function validate_form(form)
  9. {
  10. with (form)
  11. {
  12.     if ((form.file.value)=="") {
  13.         alert( "The Send e-mail list must be filled!" );
  14.         form.file.focus();
  15.         return false ;
  16.     }
  17.   return true;
  18.   }
  19. }
  20. //-->
  21. </script>
  22. <style type="text/css">
  23. <!--
  24. .style1 {
  25.     color: #FFFFFF;
  26.     font-weight: bold;
  27. }
  28. .style2 {font-family: Arial, Helvetica, sans-serif}
  29. -->
  30. </style>
  31. </head>
  32. <body>
  33. <?php
  34. if($_GET["attachment"]!=""){
  35. $NumberOfAttachment=$_GET["attachment"];
  36. $subject=$_GET["subject"];
  37. }else{
  38. $NumberOfAttachment=1;
  39. }
  40. ?>
  41. <form action="./send_newsletter.php" method="post" enctype="multipart/form-data" name="newsletter" onSubmit="return validate_form(this)">
  42.   <table width="733" border="1" align="center">
  43.     <tr bgcolor="#99FFFF">
  44.       <td colspan="3" bgcolor="#003366"><div align="center">
  45.         <h1 class="style1">AIDINDIA Newsletter</h1>
  46.       </div></td>
  47.     </tr>
  48.             <tr bgcolor="#FFFFCC">
  49.               <td bgcolor="#99CCCC">&nbsp;</td>
  50.               <td colspan="2" bgcolor="#99CCCC"><span class="style2">**Please confirm your attached file firstly. </span></td>
  51.     </tr>
  52.             <tr bgcolor="#FFFFCC">
  53.       <td bgcolor="#99CCCC"><strong>Attached file: </strong>** </td>
  54.       <td colspan="2" bgcolor="#99CCCC"><label>
  55.       <input name="nuOfAttachment" type="hidden" value="<?=$NumberOfAttachment?>" />
  56.       <?php
  57.           for($i=$NumberOfAttachment;$i>0;$i--){
  58.         ?>
  59.        <input type="file" name="attachment<?=$i?>">
  60.        <?php
  61.         }
  62.         $NumberOfAttachment++;
  63.         ?>
  64.        <input name="Addattachment" type="button" onclick="location.href='newsletter.php?attachment=<?=$NumberOfAttachment?>'" value="Add attachment"  />
  65.       </label></td>
  66.     </tr>
  67.         <tr bgcolor="#FFFFCC">
  68.       <td width="152" bgcolor="#99CCCC"><strong>Email Subject:</strong> </td>
  69.       <td colspan="2" bgcolor="#99CCCC"><label>
  70.       <input name="subject" type="text" size="60" />
  71.       </label></td>
  72.     </tr>
  73.     <tr bgcolor="#FFFFCC">
  74.       <td width="152" bgcolor="#99CCCC"><strong>Email Body: </strong></td>
  75.       <td colspan="2" bgcolor="#99CCCC"><label>
  76.         <textarea name="email_body" cols="60" rows="10" ></textarea>
  77.       </label></td>
  78.     </tr>
  79.     <tr bgcolor="#FFFFCC">
  80.       <td bgcolor="#99CCCC"><strong>Send e-mail list:</strong> * </td>
  81.       <td colspan="2" bgcolor="#99CCCC"><label>
  82.         <input name="file" type="file" size="30" />
  83.       *</label></td>
  84.     </tr>
  85.     <tr bgcolor="#FFFFCC">
  86.       <td bgcolor="#99CCCC">&nbsp;</td>
  87.       <td width="224" bgcolor="#99CCCC"><label>
  88.         <input type="submit" name="Submit" value="Send Newsletter" />
  89.       </label></td>
  90.       <td width="335" bgcolor="#99CCCC"><input type="button" name="Submit2" value="Reset" onClick="location.href='newsletter.php'" /></td>
  91.     </tr>
  92.   </table>
  93. </form>
  94. </body>
  95. </html>
  96.  
  97.  
  98. sendnewsletter.php
  99.  
  100. !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  101. <html xmlns="http://www.w3.org/1999/xhtml">
  102. <head>
  103. <meta http-equiv="Content-Type" content="text/html; charset=big5" />
  104. <title>Send Newsletter System(SNS)</title>
  105. <style type="text/css">
  106. <!--
  107. .style1 {
  108.     color: #FFFFFF;
  109.     font-weight: bold;
  110. }
  111. -->
  112. </style>
  113. </head>
  114.  
  115. <body>
  116.  
  117. <style type="text/css">
  118. <!--
  119. .style3 {color: #FF0000}
  120. -->
  121. </style><table width="733" border="1" align="center">
  122.   <tr bgcolor="#CC6633">
  123.     <td colspan="3" bgcolor="#003366"><div align="center">
  124.       <h1 class="style1">AIDINDIA Newsletter</h1>
  125.     </div></td>
  126.   </tr>
  127.     <tr bgcolor="#99CCCC">
  128.     <td><strong>Attached file:</strong></td>
  129.     <td colspan="2">
  130.     <?php
  131.     $var_nuOfAttachment=$nuOfAttachment;
  132.     while($var_nuOfAttachment>0){
  133.     ?>    
  134.     <?=$_FILES["attachment$var_nuOfAttachment"]["name"]?>
  135.     <br />
  136.     <?php
  137.     $var_nuOfAttachment--;
  138.     }
  139.     ?>
  140.     </td>
  141.   </tr>
  142.   <tr bgcolor="#99CCCC">
  143.     <td><strong>Email Subject: </strong></td>
  144.     <td colspan="2"><?=$subject?></td>
  145.   </tr>
  146.   <tr bgcolor="#99CCCC">
  147.     <td><strong>Email Body:</strong></td>
  148.     <td colspan="2"><?=$email_body?></td>
  149.   </tr>
  150.   <tr bgcolor="#99CCCC">
  151.     <td width="169"><strong>Have been Sent email to:</strong> </td>
  152.     <td width="548" colspan="2"><label>
  153.  
  154.     <?php    
  155.     #Program:
  156.     # This program can let staff to send newsletter by email list.
  157.     #
  158.     #History:
  159.     #19June2008     FFan      Version 1.1
  160.     #
  161.     #Version 1.0 send newsletter.
  162.     #Version 1.1 the email content can be html. 
  163.     #Versoin 1.1 the uploaded email list can overwrite exist one.
  164.     #Please send email to me fanpingchun@hotmail.com when you think it can improve anymore.
  165.     #Thank you so much~~Hope u enjoy it.
  166.  
  167.     ########################Define the smtp server,port number and send from################################
  168.     ini_set("SMTP","smtp.mail.yahoo.com");
  169.     ini_set("smtp_port","25");
  170.     $from="aajayaprakash@yahoo.com";    ########################################################################################################
  171.  
  172.     #read text file for send newsletter list
  173.     if ($_FILES["file"]["name"] =="")
  174.     {
  175.         echo "No sent email list!";
  176.     }
  177.     elseif ($_FILES["file"]["error"] > 0)
  178.     {
  179.         echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
  180.     }
  181.      else
  182.     {
  183.         //if (file_exists("upload/" . $_FILES["file"]["name"]))
  184.         //{
  185.          //     echo "Warming! The ". $_FILES["file"]["name"]." Send e-mail list has already exists. Please change the Send e-mail list name and send newsletter again.";
  186.         //    echo "<br>"."The newsletter has not been sent!";
  187.         //}
  188.         //else
  189.         if(1>0)
  190.         {
  191.               move_uploaded_file($_FILES["file"]["tmp_name"],
  192.               "upload/" . $_FILES["file"]["name"]);
  193.              echo "The ". $_FILES["file"]["name"]." Send e-mail list has been stored in server successfully. ";
  194.  
  195.  
  196.             echo "<br>";
  197.             $file = "upload/" . $_FILES["file"]["name"];
  198.             $f = fopen($file, "r");
  199.             while ( $line = fgets($f, 100000) ) {
  200.                 $num++;
  201.                 $to = "$line";
  202.                 if($_FILES["attachment$nuOfAttachment"]["name"]!=""){
  203. ############### Attached file function#################        
  204. $boundary = uniqid( ""); 
  205. # make the email headers
  206. $headers = "From: $from
  207. Content-type: multipart/mixed; boundary=\"$boundary\"";
  208. $body = "--$boundary
  209. Content-type: text/html; charset=iso-8859-1
  210. Content-transfer-encoding: 8bit
  211.  
  212. $email_body
  213.  
  214. ";
  215. for($var_nuOfAttachment=1;$var_nuOfAttachment<=$nuOfAttachment;$var_nuOfAttachment++){
  216. //echo $var_nuOfAttachment;
  217. # check the upload file type
  218. if ($_FILES["attachment$var_nuOfAttachment"]["type"]) $mimeType = $_FILES["attachment$var_nuOfAttachment"]["type"];
  219. # in case no file type then set to unknown
  220. else $mimeType = "application/unknown";
  221.  
  222. # create the name of the file
  223. $fileName = $_FILES["attachment$var_nuOfAttachment"]["name"];
  224.  
  225. # read the file
  226. $fp = fopen($_FILES["attachment$var_nuOfAttachment"]['tmp_name'] , "r");
  227.  
  228. # convert it
  229. $read = fread($fp, filesize($_FILES["attachment$var_nuOfAttachment"]['tmp_name']));
  230. $read = base64_encode($read);
  231. $read = chunk_split($read); 
  232.  
  233. # make the email body
  234. $body =$body."--$boundary
  235. Content-type: $mimeType; name=$fileName
  236. Content-disposition: inline; filename=$fileName
  237. Content-transfer-encoding: base64
  238.  
  239. $read
  240.  
  241. ";
  242.  
  243. }
  244. $body =$body."--$boundary--"; 
  245. //echo $body;
  246. #########################################################
  247.  
  248.                     # send email one by one
  249.                     mail($to, $subject, $body, $headers);
  250.                     }else{
  251.                         $headers = "From: $from";
  252. ##################################################################################################################    
  253. $headers = "From: $from
  254. MIME-Version: 1.0
  255. Content-type: text/html; charset=iso-8859-1";            
  256. $html_email_body = "
  257. $email_body
  258. ";
  259. #############################################################################
  260.                         mail($to, $subject, $html_email_body, $headers);
  261.                     }                                                    
  262.         ############### Attached file function#################
  263.                 echo "The newsletter has sent to ";
  264.                 echo "<span class=style3>";
  265.                 echo "$line";
  266.                 echo "</span>";    
  267.                 echo "<br>";    
  268.             }
  269.          }
  270.     }
  271. ?>
  272.  
  273.     </label></td>
  274.   </tr>
  275.     <tr bgcolor="#99CCCC">
  276.     <td>&nbsp;</td>
  277.     <td colspan="2"><input type="button" name="Submit2" value="Return Main" onClick="location.href='index.php'" /></td>
  278.   </tr>
  279. </table>
  280.  
  281. </body>
  282. </html>

I upload but not working

what can i do Pleas send reply soon regards
A. Jaya prakash
Aug 10 '09 #10
i want html file send to email from PHP coading pleas help me
Aug 13 '09 #11
MrMancunian
569 Expert 512MB
Do you want us to guess what part is not working? Or do you expect us to read 282 lines of code to see what is wrong? Try to specify what part is not working. Perhaps the person who gave you this code can tell you what is wrong?

Steven
Aug 13 '09 #12
Dormilich
8,658 Expert Mod 8TB
side note: I find SwiftMailer very comfotable (especially when it come to html mails) and easy to implement (plus they have quite an impressive documentation).
Aug 13 '09 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jeremy Ross | last post by:
Hello, We are looking for a Newsletter Program that is tested and is knowing to work with PHP/MySQL. We will be having allot of people use this newsletter so it should be able to handle sending...
3
by: Pilu | last post by:
Hi, I have to send a newsletter to more then 8000 address! What is the best way to do it? sending all together?, with mail() function?, with smtp?, divided in groups....??? tnx so much!
2
by: Nis Sarup | last post by:
A customer of mine wants to make a newsletter for their website. The newsletter should be HTML with images and sent to a database of her subscribers. They would like a script where they can easily...
0
by: cooldv | last post by:
i have an *access database + ASP newsletter* that is working fine and it sends newsletter to ALL the email addresses in the DB. i want to send this newsletter to only a select group (like people...
5
by: Neven | last post by:
Hi, Is there a trick how to use CSS in newsletters ? I'm trying to use CSS formating when creating newsletter, but when i recieve CSS newsletter, no CSS formating is visible, all the text is...
0
by: sylvain | last post by:
http://groups.yahoo.com/group/HiTechUnited (Source of articles about the HiTech Underemployment Crisis) HiTechUnited is a weekly newsletter, delivered Mondays, written by and for...
1
by: Michel Couche | last post by:
Hello, I am starting the development of a newsletter The use of the class MailMessage of System.Net.Mail is quite straightforward for usual contact forms but my question here is "How can I...
3
by: neopersia | last post by:
hello I'm designing a newsletter for my site and I gonna send my newsletters using mail() function. I want each user that receives newsletter be able to see just his email address in "TO" field and...
11
by: ginoplusio | last post by:
Hi, I'm developing a software to send newsletter to the users of my website. I have a problem on the stats, detecting the opening of the newsletter on the user's client. The method I've chosen...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.