NEWSLETTER in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aajayaprakash
    Banned
    New Member
    • Aug 2009
    • 13

    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
  • aajayaprakash
    Banned
    New Member
    • Aug 2009
    • 13

    #2
    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

    Comment

    • aajayaprakash
      Banned
      New Member
      • Aug 2009
      • 13

      #3
      i have working simple newsletter paths is http://aidindia.com/mailer/ but not working

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        I use a simple newsletter based on SwiftMailer, but there should be lots of sample scripts around (google)

        Comment

        • aajayaprakash
          Banned
          New Member
          • Aug 2009
          • 13

          #5
          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



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

          Regards
          A. Jaya prakash

          Comment

          • dlite922
            Recognized Expert Top Contributor
            • Dec 2007
            • 1586

            #6
            Originally posted by aajayaprakash
            full coading i want
            You won't get it here buddy. Try the next forum.




            Dan

            Comment

            • aajayaprakash
              Banned
              New Member
              • Aug 2009
              • 13

              #7
              dear sir i want newsletter no database in PHP if u have send me my mail adddress <email removed>

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                I have not, but google has.

                Comment

                • MrMancunian
                  Recognized Expert Contributor
                  • Jul 2008
                  • 569

                  #9
                  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

                  Comment

                  • aajayaprakash
                    Banned
                    New Member
                    • Aug 2009
                    • 13

                    #10
                    Thanks for reply

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


                    newsletter.php

                    Code:
                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                    <html xmlns="http://www.w3.org/1999/xhtml">
                    <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=big5" />
                    <title>Send Newsletter System (SNS)</title>
                    
                    <script language="JavaScript" type="text/javascript"><!--
                    function validate_form(form)
                    {
                    with (form)
                    {
                    	if ((form.file.value)=="") {
                        	alert( "The Send e-mail list must be filled!" );
                        	form.file.focus();
                        	return false ;
                    	}
                      return true;
                      }
                    }
                    //-->
                    </script>
                    <style type="text/css">
                    <!--
                    .style1 {
                    	color: #FFFFFF;
                    	font-weight: bold;
                    }
                    .style2 {font-family: Arial, Helvetica, sans-serif}
                    -->
                    </style>
                    </head>
                    <body>
                    <?php
                    if($_GET["attachment"]!=""){
                    $NumberOfAttachment=$_GET["attachment"];
                    $subject=$_GET["subject"];
                    }else{
                    $NumberOfAttachment=1;
                    }
                    ?>
                    <form action="./send_newsletter.php" method="post" enctype="multipart/form-data" name="newsletter" onSubmit="return validate_form(this)">
                      <table width="733" border="1" align="center">
                        <tr bgcolor="#99FFFF">
                          <td colspan="3" bgcolor="#003366"><div align="center">
                            <h1 class="style1">AIDINDIA Newsletter</h1>
                          </div></td>
                        </tr>
                    		    <tr bgcolor="#FFFFCC">
                    		      <td bgcolor="#99CCCC">&nbsp;</td>
                    		      <td colspan="2" bgcolor="#99CCCC"><span class="style2">**Please confirm your attached file firstly. </span></td>
                        </tr>
                    		    <tr bgcolor="#FFFFCC">
                          <td bgcolor="#99CCCC"><strong>Attached file: </strong>** </td>
                          <td colspan="2" bgcolor="#99CCCC"><label>
                    	  <input name="nuOfAttachment" type="hidden" value="<?=$NumberOfAttachment?>" />
                    	  <?php
                    	  	for($i=$NumberOfAttachment;$i>0;$i--){
                    		?>
                           <input type="file" name="attachment<?=$i?>">
                    	   <?php
                    		}
                    		$NumberOfAttachment++;
                    		?>
                           <input name="Addattachment" type="button" onclick="location.href='newsletter.php?attachment=<?=$NumberOfAttachment?>'" value="Add attachment"  />
                          </label></td>
                        </tr>
                    	    <tr bgcolor="#FFFFCC">
                          <td width="152" bgcolor="#99CCCC"><strong>Email Subject:</strong> </td>
                          <td colspan="2" bgcolor="#99CCCC"><label>
                          <input name="subject" type="text" size="60" />
                          </label></td>
                        </tr>
                        <tr bgcolor="#FFFFCC">
                          <td width="152" bgcolor="#99CCCC"><strong>Email Body: </strong></td>
                          <td colspan="2" bgcolor="#99CCCC"><label>
                            <textarea name="email_body" cols="60" rows="10" ></textarea>
                          </label></td>
                        </tr>
                        <tr bgcolor="#FFFFCC">
                          <td bgcolor="#99CCCC"><strong>Send e-mail list:</strong> * </td>
                          <td colspan="2" bgcolor="#99CCCC"><label>
                            <input name="file" type="file" size="30" />
                          *</label></td>
                        </tr>
                        <tr bgcolor="#FFFFCC">
                          <td bgcolor="#99CCCC">&nbsp;</td>
                          <td width="224" bgcolor="#99CCCC"><label>
                            <input type="submit" name="Submit" value="Send Newsletter" />
                          </label></td>
                          <td width="335" bgcolor="#99CCCC"><input type="button" name="Submit2" value="Reset" onClick="location.href='newsletter.php'" /></td>
                        </tr>
                      </table>
                    </form>
                    </body>
                    </html>
                    
                    
                    sendnewsletter.php
                    
                    !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                    <html xmlns="http://www.w3.org/1999/xhtml">
                    <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=big5" />
                    <title>Send Newsletter System(SNS)</title>
                    <style type="text/css">
                    <!--
                    .style1 {
                    	color: #FFFFFF;
                    	font-weight: bold;
                    }
                    -->
                    </style>
                    </head>
                    
                    <body>
                    
                    <style type="text/css">
                    <!--
                    .style3 {color: #FF0000}
                    -->
                    </style><table width="733" border="1" align="center">
                      <tr bgcolor="#CC6633">
                        <td colspan="3" bgcolor="#003366"><div align="center">
                          <h1 class="style1">AIDINDIA Newsletter</h1>
                        </div></td>
                      </tr>
                        <tr bgcolor="#99CCCC">
                        <td><strong>Attached file:</strong></td>
                        <td colspan="2">
                    	<?php
                    	$var_nuOfAttachment=$nuOfAttachment;
                    	while($var_nuOfAttachment>0){
                    	?>	
                        <?=$_FILES["attachment$var_nuOfAttachment"]["name"]?>
                    	<br />
                    	<?php
                    	$var_nuOfAttachment--;
                    	}
                    	?>
                    	</td>
                      </tr>
                      <tr bgcolor="#99CCCC">
                        <td><strong>Email Subject: </strong></td>
                        <td colspan="2"><?=$subject?></td>
                      </tr>
                      <tr bgcolor="#99CCCC">
                        <td><strong>Email Body:</strong></td>
                        <td colspan="2"><?=$email_body?></td>
                      </tr>
                      <tr bgcolor="#99CCCC">
                        <td width="169"><strong>Have been Sent email to:</strong> </td>
                        <td width="548" colspan="2"><label>
                    	
                    	<?php	
                    	#Program:
                    	# This program can let staff to send newsletter by email list.
                    	#
                    	#History:
                    	#19June2008     FFan      Version 1.1
                    	#
                    	#Version 1.0 send newsletter.
                    	#Version 1.1 the email content can be html. 
                    	#Versoin 1.1 the uploaded email list can overwrite exist one.
                    	#Please send email to me [email]fanpingchun@hotmail.com[/email] when you think it can improve anymore.
                    	#Thank you so much~~Hope u enjoy it.
                    	
                    	########################Define the smtp server,port number and send from################################
                    	[B][B]ini_set("SMTP","smtp.mail.yahoo.com");
                    	ini_set("smtp_port","25");
                    	$from="aajayaprakash@yahoo.com";[/B][/B]	########################################################################################################
                    	
                    	#read text file for send newsletter list
                    	if ($_FILES["file"]["name"] =="")
                        {
                        	echo "No sent email list!";
                        }
                    	elseif ($_FILES["file"]["error"] > 0)
                        {
                        	echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
                        }
                     	else
                        {
                        	//if (file_exists("upload/" . $_FILES["file"]["name"]))
                        	//{
                         	// 	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.";
                    		//	echo "<br>"."The newsletter has not been sent!";
                        	//}
                        	//else
                    		if(1>0)
                        	{
                          		move_uploaded_file($_FILES["file"]["tmp_name"],
                          		"upload/" . $_FILES["file"]["name"]);
                         		echo "The ". $_FILES["file"]["name"]." Send e-mail list has been stored in server successfully. ";
                    
                    
                    			echo "<br>";
                    			$file = "upload/" . $_FILES["file"]["name"];
                    			$f = fopen($file, "r");
                    			while ( $line = fgets($f, 100000) ) {
                    				$num++;
                    				$to = "$line";
                    				if($_FILES["attachment$nuOfAttachment"]["name"]!=""){
                    ############### Attached file function#################		
                    $boundary = uniqid( ""); 
                    # make the email headers
                    $headers = "From: $from
                    Content-type: multipart/mixed; boundary=\"$boundary\"";
                    $body = "--$boundary
                    Content-type: text/html; charset=iso-8859-1
                    Content-transfer-encoding: 8bit
                    
                    $email_body
                    
                    ";
                    for($var_nuOfAttachment=1;$var_nuOfAttachment<=$nuOfAttachment;$var_nuOfAttachment++){
                    //echo $var_nuOfAttachment;
                    # check the upload file type
                    if ($_FILES["attachment$var_nuOfAttachment"]["type"]) $mimeType = $_FILES["attachment$var_nuOfAttachment"]["type"];
                    # in case no file type then set to unknown
                    else $mimeType = "application/unknown";
                    
                    # create the name of the file
                    $fileName = $_FILES["attachment$var_nuOfAttachment"]["name"];
                    
                    # read the file
                    $fp = fopen($_FILES["attachment$var_nuOfAttachment"]['tmp_name'] , "r");
                    
                    # convert it
                    $read = fread($fp, filesize($_FILES["attachment$var_nuOfAttachment"]['tmp_name']));
                    $read = base64_encode($read);
                    $read = chunk_split($read); 
                    				
                    # make the email body
                    $body =$body."--$boundary
                    Content-type: $mimeType; name=$fileName
                    Content-disposition: inline; filename=$fileName
                    Content-transfer-encoding: base64
                    
                    $read
                    
                    ";
                    
                    }
                    $body =$body."--$boundary--"; 
                    //echo $body;
                    #########################################################
                    				
                    					# send email one by one
                    					mail($to, $subject, $body, $headers);
                    					}else{
                    						$headers = "From: $from";
                    ##################################################################################################################	
                    $headers = "From: $from
                    MIME-Version: 1.0
                    Content-type: text/html; charset=iso-8859-1";			
                    $html_email_body = "
                    $email_body
                    ";
                    #############################################################################
                    						mail($to, $subject, $html_email_body, $headers);
                    					}													
                    		############### Attached file function#################
                    				echo "The newsletter has sent to ";
                    				echo "<span class=style3>";
                    				echo "$line";
                    				echo "</span>";	
                    				echo "<br>";	
                    			}
                         	}
                        }
                    ?>
                    	
                    	</label></td>
                      </tr>
                        <tr bgcolor="#99CCCC">
                        <td>&nbsp;</td>
                        <td colspan="2"><input type="button" name="Submit2" value="Return Main" onClick="location.href='index.php'" /></td>
                      </tr>
                    </table>
                    
                    </body>
                    </html>

                    I upload but not working

                    what can i do Pleas send reply soon regards
                    A. Jaya prakash
                    Last edited by Markus; Aug 10 '09, 02:46 PM. Reason: Added [code] tags.

                    Comment

                    • aajayaprakash
                      Banned
                      New Member
                      • Aug 2009
                      • 13

                      #11
                      i want html file send to email from PHP coading pleas help me

                      Comment

                      • MrMancunian
                        Recognized Expert Contributor
                        • Jul 2008
                        • 569

                        #12
                        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

                        Comment

                        • Dormilich
                          Recognized Expert Expert
                          • Aug 2008
                          • 8694

                          #13
                          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).

                          Comment

                          Working...