Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Email Sending., email sending with php.
khosro_php
post Apr 25 2007, 09:10 PM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 25-April 07
Member No.: 42,180



this script allow user to send an email for you.
i hope you enjoy wink.gif

CODE
[color="#0000ff"][indent]<?
  
  $top='<html dir="rtl">
  
  <head>
  <meta http-equiv="Content-Language" content="fa">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  
  <body>
  
  <div align="center">
      <p style="margin-top: 0; margin-bottom: 0">
      <font face="Tahoma" size="1" color="#003366">in the name of god</font></p>
      <p style="margin-top: 0; margin-bottom: 0"><b>
      <font face="Tahoma" size="1" color="#003366">contents of recived form</font></b></p>
      <p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="1">&nbsp;</font></p>
      <table border="0" cellpadding="0" style="border-collapse: collapse" width="500" height="20" bordercolor="#000000" id="table1">
          <tr>
              <td width="161" height="24" style="border-style: solid; border-width: 1px" bgcolor="#F4F4F4" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px"><b>
              <font face="Tahoma" style="font-size: 9pt">name of choce</font></b></td>
              <td height="24" style="border-style: solid; border-width: 1px" bgcolor="#F4F4F4" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px"><b>
              <font face="Tahoma" style="font-size: 9pt">&nbsp;user data entered
              </font></b></td>
          </tr>';
  ##############################
  $body='        <tr>
              <td width="161" style="border-style: solid; border-width: 1px" height="24" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px"><span lang="en-us">
              <font face="Tahoma" style="font-size: 9pt">%field</font></span></td>
              <td style="border-style: solid; border-width: 1px" height="24" bordercolor="#333333">
              <p align="justify" style="margin: 2px 10px; "><span lang="en-us">
              <font face="Tahoma" style="font-size: 9pt">%info</font></span></td>
          </tr>';
  ##############################
  $footer='    </table>
      <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
      <p style="margin-top: 0; margin-bottom: 0"><b><font face="Tahoma" size="1">&nbsp;</font></b></div>
  
  <div align="center">
      <table border="0" cellpadding="0" style="border-collapse: collapse" width="500" height="20" bordercolor="#000000" id="table2">
          <tr>
              <td height="25" style="border-style: solid; border-width: 1px" bgcolor="#F2CC84" colspan="2" bordercolor="#333333">
      <p style="margin-top: 0; margin-bottom: 0" align="center"><b>
      <font face="Tahoma" size="1" color="#800000">user information</font></b></p>
              </td>
          </tr>
          <tr>
              <td width="161" height="25" style="border-style: solid; border-width: 1px" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px">
              <font face="Tahoma" style="font-size: 9pt">ip address</font></td>
              <td height="25" style="border-style: solid; border-width: 1px" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px"><span lang="en-us">
              <font face="Tahoma" style="font-size: 9pt">%ip</font></span></td>
          </tr>
          <tr>
              <td width="161" style="border-style: solid; border-width: 1px" height="25" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px">
              <font face="Tahoma" style="font-size: 9pt">your link</font></td>
              <td style="border-style: solid; border-width: 1px" height="25" bordercolor="#333333">
              <p align="center" style="margin: 2px 5px"><span lang="en-us">
              <font face="Tahoma" style="font-size: 9pt">%link</font></span></td>
          </tr>
          </table>
      <p align="center" style="margin: 2px 5px">&nbsp;<p align="center" style="margin: 2px 5px">&nbsp;</div>
  
  <p align="center" dir="ltr" style="margin-top: 2px; margin-bottom: 2px">
  <span lang="en-us"><font face="Verdana" size="1" color="#333333">if you can,t
  Read this , change the encoding to UTF-8</font></span></p>
  <p align="center" style="margin-top: 2px; margin-bottom: 2px">
  <span lang="en-us"><font size="1" face="Verdana">
  <a href="http://khosro.tk"><font color="#800000">Powered By: www.khosro.tk</font></a></font></span></p>
  
  <p align="center">&nbsp;</p>
  
  </body>
  
  </html>';
  ##############################
  if (isset($_POST['email']))
      $email=$_POST['email'];
  else
      $email=$from;
  if (isset($_POST['subject']))
      $subject=$_POST['subject'];
  ##############################
  $header='From: "'.$email.'" <'.$email.">rn"
  .'Reply-To: "'.$email.'" <'.$email.">rn"
  .'To:<'.$to.">rn"
  ."(anti-spam-(anti-spam-(anti-spam-(anti-spam-mime-version:)))) 1.0rn"
  ."(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) text/html; charset=utf-8rn"
  ."Content-Transfer-Encoding: 7bitrn";
  ##############################
  $main='';
  foreach($_POST as $k => $v)
      {
      $lists=$body;
      $lists=ereg_replace('%field',$k,$body);
      $lists=ereg_replace('%info',$v,$lists);
      $main .=$lists;
      }
  #############################
  $ip= $_SERVER['REMOTE_ADDR'];
  $link=$_SERVER['HTTP_REFERER'];
  $footer=ereg_replace('%ip',$ip,$footer);
  $footer=ereg_replace('%link',$link,$footer);
  $body=$top.$main.$footer;
  mail($to,$subject,$body, $header);
  header("location: $redirect")
  ?>[/indent][/color]
Notice from jlhaslip:
code tags added
Go to the top of the page
 
+Quote Post
hitmanblood
post May 6 2007, 02:53 PM
Post #2


Privileged Member
*********

Group: [HOSTED]
Posts: 792
Joined: 13-April 07
From: mreža
Member No.: 41,558



Well are you sure that this script works if you send mail on some other server because I found many problems with such things also. I would suggest that anyone who would like to use specialized class called php mailer. It solves all your problems and anyone who use is able to send also attachments by using it.

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Email Form(12)
  2. Form To Pdf, With Email?(3)
  3. Protecting Web Email Forms(3)
  4. How Handle Sending Back Multiple Checkboxes(1)
  5. Sending Attachments Using Email Function In Php(2)
  6. Sending Messeges Over A Website.(3)
  7. Email Server Help Please(0)
  8. Yet Another Problem With A Form Script(6)
  9. Wappymail_v1.50(15)
  10. Phpnuke Newsletter Sending Problems(0)
  11. Email Header Inject Test(0)
  12. Add Users On Email Program With Php?(1)
  13. Sending $_get[] Variables To An Application(3)
  14. Trouble With Phpbb Email(1)
  15. Php Email Validation(1)
  1. An Interesting Approach To Email Verification...(6)
  2. Sending E-mails After News Update?(8)
  3. Sending E-mails Based On Intervals?(7)


 



- Lo-Fi Version Time is now: 6th September 2008 - 01:56 AM