473,386 Members | 1,908 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,386 software developers and data experts.

Page name(URL) displayed when sending mail through PHP

134 100+
Hi all.,

I m having a website in which paypal acts as a payment gateway.,

i m using IPN to validate the payment and send confirmation mail to the recipients in my notiy url(e.g http://www.mysite.com/notify.php)

Everything works fine., but in yahoomail when i opened the email received and viewed the full headers of the mail.,

i can see the URL from which the mail is sent.

Like..
Expand|Select|Wrap|Line Numbers
  1. From Ticket Master Thu May  12 07:14:43 2011
  2. X-Apparently-To: vays_ij@yahoo.co.in via.....
  3. .......
  4. ..............
  5. Date: Mon, 09 May 2011 15:14:43 +0800
  6. To: testing <vays_ij@yahoo.co.in>
  7. Subject: Ticket confirmation from ticketmaster
  8. X-PHP-Script: www.mysite.com/notify.php for 192.168.1.2(server IP)
  9. From: Ticket Master <booking@mysite.com>
  10. Reply-To: Ticket Master <booking@mysite.com>
  11. Sender: booking@mysite.com
  12. MIME-Version: 1.0
  13. Content-Type: multipart/related; boundary="c052e8f7510af91ee938fb2081d381d1"
  14. Message-ID: <20110509151443.5890.booking@mysite.com>
  15. Content-Length: 96625
  16.  
I am not sure about the other mail services.

I felt that this is not safety enough to protect my code..

I amusing the class file from the below link to send the email..

Also attached the file.

Expand|Select|Wrap|Line Numbers
  1. http://www.phpclasses.org/package/9-PHP-PHP-mailer-to-compose-and-send-MIME-messages.html#download
  2.  
and here is my code which send the email using the script..

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require("email_message.php");
  3. /*
  4.  *  Trying to guess your e-mail address.
  5.  *  It is better that you change this line to your address explicitly.
  6.  *  $from_address="me@mydomain.com";
  7.  *  $from_name="My Name";
  8.  */
  9. //    $from_address=getenv("USER")."@".getenv("HOSTNAME").'<br>';
  10. //    $from_name=getenv("USERNAME");
  11.     $from_address="booking@mysite.com";
  12.     $from_name="Ticket Master";
  13.  
  14.     $reply_name=$from_name;
  15.     $reply_address=$from_address;
  16.     $reply_address=$from_address;
  17.     $error_delivery_name=$from_name;
  18.     $error_delivery_address=$from_address;
  19.  
  20. /*
  21.  *  Change these lines or else you will be mailing the class author.
  22.  */
  23.     $to_name='Vijay anand';
  24.     $to_address='vays_ij@yahoo.co.in';
  25.  
  26.     $subject="Ticket confirmation from ticketmaster";
  27.     $email_message=new email_message_class;
  28.     $email_message->SetEncodedEmailHeader("To",$guest_address,$guest_name);
  29.     $email_message->SetEncodedEmailHeader("From",$from_address,$from_name);
  30.     $email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name);
  31.     $email_message->SetHeader("Sender",$from_address);
  32.  
  33. /*
  34.  *  Set the Return-Path header to define the envelope sender address to which bounced messages are delivered.
  35.  *  If you are using Windows, you need to use the smtp_message_class to set the return-path address.
  36.  */
  37.     if(defined("PHP_OS")
  38.     && strcmp(substr(PHP_OS,0,3),"WIN"))
  39.         $email_message->SetHeader("Return-Path",$error_delivery_address);
  40.  
  41.     $email_message->SetEncodedHeader("Subject",$subject);
  42.  
  43. /*
  44.  *  An HTML message that requires any dependent files to be sent,
  45.  *  like image files, style sheet files, HTML frame files, etc..,
  46.  *  needs to be composed as a multipart/related message part.
  47.  *  Different parts need to be created before they can be added
  48.  *  later to the message.
  49.  *
  50.  *  Parts can be created from files that can be opened and read.
  51.  *  The data content type needs to be specified. The can try to guess
  52.  *  the content type automatically from the file name.
  53.  */
  54.  
  55.  
  56.  
  57.     $image=array(
  58.         "FileName"=>"http://www.mysite.com/logo.gif",
  59.         "Content-Type"=>"automatic/name",
  60.         "Disposition"=>"inline",
  61. /*
  62.  *  You can set the Cache option if you are going to send the same message
  63.  *  to multiple users but this file part does not change.
  64.  *
  65.         "Cache"=>1
  66.  */
  67.     );
  68.     $email_message->CreateFilePart($image,$image_part);
  69.  
  70. /*
  71.  *  Parts that need to be referenced from other parts,
  72.  *  like images that have to be hyperlinked from the HTML,
  73.  *  are referenced with a special Content-ID string that
  74.  *  the class creates when needed.
  75.  */
  76.     $image_content_id=$email_message->GetPartContentID($image_part);
  77.  
  78.  
  79. /*
  80.  *  Many related file parts may be embedded in the message.
  81.  */
  82.     $image=array(
  83.         "FileName"=>"http://www.mysite.com/images/voucher_header.jpg",
  84.         "Content-Type"=>"automatic/name",
  85.         "Disposition"=>"inline",
  86.     );
  87.     $email_message->CreateFilePart($image,$background_image_part);
  88.     $background_image_content_id="cid:".$email_message->GetPartContentID($background_image_part);
  89.  
  90. $html_message="<html>
  91. <head>
  92. <title>$subject</title>
  93. <style type=\"text/css\"><!--
  94. body{
  95. margin:0px;
  96. padding:0px;
  97. }
  98. --></style>
  99. </head>
  100. <body>";
  101. $html_message.='<table background="'.$background_image_content_id.'" style="background-repeat:no-repeat;color: black ;font-family:Calibri;background-color: #FFFFFF;background-repeat:no-repeat;border:1px solid #000;" width="1000px" border="0" cellspacing="0" cellpadding="0" align="left">
  102. <tr>
  103.   <td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-left:10px;padding-bottom:20px;">
  104.   <tr>
  105.     <td align="left" valign="top">&nbsp;</td>
  106.     <td align="left" valign="top">&nbsp;</td>
  107.     <td height="140px" colspan="2" align="center" valign="bottom" style="font-size:40px;"><b>GUEST VOUCHER</b></td>
  108.   </tr>
  109.   <tr>
  110.     <td align="left" valign="top">&nbsp;</td>
  111.     <td align="left" valign="top">&nbsp;</td>
  112.     <td colspan="2">&nbsp;</td>
  113.   </tr>
  114.   <tr>
  115.     <td height="80px" colspan="4" align="left" valign="top">&nbsp;</td>
  116.   </tr>
  117.   <tr>
  118.     <td height="40" align="left" valign="top">Package</td>
  119.     <td align="left" valign="top">GF456</td>
  120.     <td align="left" valign="top">Arrival</td>
  121.     <td align="left" valign="top">16-05-2011</td>
  122.   </tr>
  123.   <tr>
  124.     <td height="40" align="left" valign="top">RefNo</td>
  125.     <td align="left" valign="top">GKR459DK</td>
  126.     <td align="left" valign="top">Departure</td>
  127.     <td align="left" valign="top">18-05-2011</td>
  128.   </tr>
  129.   <tr>
  130.     <td height="40" align="left" valign="top">Customer Name</td>
  131.     <td align="left" valign="top">VIJAY ANAND</td>
  132.     <td align="left" valign="top">Check in</td>
  133.     <td align="left" valign="top">10:00hrs</td>
  134.   </tr>
  135.   <tr>
  136.     <td height="40" align="left" valign="top">Member</td>
  137.     <td align="left" valign="top">GUEST</td>
  138.     <td align="left" valign="top">No of Nights</td>
  139.     <td align="left" valign="top">2</td>
  140.   </tr>
  141.   <tr>
  142.     <td height="40" align="left" valign="top">COUNTRY</td>
  143.     <td align="left" valign="top">INDIA</td>
  144.     <td align="left" valign="top">Booked date</td>
  145.     <td align="left" valign="top">15-05-2011</td>
  146.   </tr>
  147.   <tr>
  148.     <td height="40" align="left" valign="top">Hotel Name</td>
  149.     <td align="left" valign="top">HOTEL NAME</td>
  150.     <td align="left" valign="top">&nbsp;</td>
  151.     <td align="left" valign="top">&nbsp;</td>
  152.   </tr>
  153.   <tr>
  154.     <td height="40" align="left" valign="top">Hotel Address</td>
  155.     <td colspan="3" align="left" valign="top">STREET NAME, CITY</td>
  156.   </tr>
  157.     <tr>
  158.       <td height="40" colspan="4" align="left" valign="top"><hr></td>
  159.     </tr>
  160.   <tr>
  161.     <td colspan="4" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  162.       <tr>
  163.         <td height="30" align="left" valign="top">Room No</td>
  164.         <td align="left" valign="top">Room Type</td>
  165.         <td align="left" valign="top">Extra beds</td>
  166.         <td align="left" valign="top">Breakfast</td>
  167.       </tr>
  168.         <tr>
  169.         <td align="left" valign="top">1</td>
  170.         <td align="left" valign="top">SINGLE</td>
  171.         <td align="left" valign="top">NO</td>
  172.         <td align="left" valign="top">YES</td>
  173.       </tr></table></td>
  174.   </tr>
  175.     <tr>
  176.       <td height="40" colspan="4" align="left" valign="top"><hr></td>
  177.     </tr>
  178.   <tr>
  179.     <td colspan="2" align="left" valign="top">Remarks</td>
  180.     <td colspan="2" align="left" valign="top">Customer Support Center 24/7</td>
  181.   </tr>
  182.   <tr>
  183.     <td colspan="2" align="left" valign="top">All special request are subject to availability upon arrival</td>
  184.     <td colspan="2" align="left" valign="top">http://www.mysite.com/customersupport.html</td>
  185.   </tr>
  186.   <tr>
  187.     <td colspan="4" align="left" valign="top">&nbsp;</td>
  188.   </tr>
  189.   <tr>
  190.     <td colspan="4" align="left" valign="top">NOTES</td>
  191.   </tr>
  192.   <tr>
  193.     <td colspan="4" align="left" valign="top">- IMPORTANT :
  194.     - The total price for this booking does not include mini-bar items, telephone usage, laundry service, etc. If applicable, the hotel will bill you directly. <br>
  195. - In cases where Breakfast is included with the room rate, please note that hotels may charge extra for children travelling with their parents. <br>
  196. Additional guest requesting extra beds are required to pay for breakfast. If appicable, the hotel will bill you directly. </td>
  197.   </tr>
  198.     <tr>
  199.       <td height="70" colspan="4" align="left" valign="top"><img src=\'cid:'.$image_content_id.'\'></td>
  200.     </tr>
  201. </table></td>
  202. </tr>
  203. </table>
  204. </body>
  205. </html>';
  206.     $email_message->CreateQuotedPrintableHTMLPart($html_message,"",$html_part);
  207.  
  208. /*
  209.  *  It is strongly recommended that when you send HTML messages,
  210.  *  also provide an alternative text version of HTML page,
  211.  *  even if it is just to say that the message is in HTML,
  212.  *  because more and more people tend to delete HTML only
  213.  *  messages assuming that HTML messages are spam.
  214.  */
  215.     $text_message="This is an HTML message. Please use an HTML capable mail program to read this message.";
  216.     $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"",$text_part);
  217.  
  218. /*
  219.  *  Multiple alternative parts are gathered in multipart/alternative parts.
  220.  *  It is important that the fanciest part, in this case the HTML part,
  221.  *  is specified as the last part because that is the way that HTML capable
  222.  *  mail programs will show that part and not the text version part.
  223.  */
  224.     $alternative_parts=array(
  225.         $text_part,
  226.         $html_part
  227.     );
  228.     $email_message->CreateAlternativeMultipart($alternative_parts,$alternative_part);
  229.  
  230. /*
  231.  *  All related parts are gathered in a single multipart/related part.
  232.  */
  233.     $related_parts=array(
  234.         $alternative_part,
  235.         $image_part,
  236.         $background_image_part
  237.     );
  238.     $email_message->AddRelatedMultipart($related_parts);
  239.  
  240. /*
  241.  *  The message is now ready to be assembled and sent.
  242.  *  Notice that most of the functions used before this point may fail due to
  243.  *  programming errors in your script. You may safely ignore any errors until
  244.  *  the message is sent to not bloat your scripts with too much error checking.
  245.  */
  246.     $error=$email_message->Send();
  247. /*
  248.     if(strcmp($error,""))
  249.         echo "Error: $error\n";
  250.     else
  251.         echo "Message sent to $to_name\n";
  252. */
  253.  
  254. ?>
  255.  
i have attached the email_message.php with this post..

since php file cannot be attached i save it as a .txt file.


Thanks.
vijay
Attached Files
File Type: txt email_message.php.txt (121.2 KB, 0 views)
May 13 '11 #1
1 1448
vjayis
134 100+
Hi everyone..

I provided all the codes that i m using.,

Anyone to help me..
May 18 '11 #2

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

Similar topics

3
by: scott john | last post by:
Hello Im trying to send a mail from a php-program. Im using a test program and the code for this is as follows: <?php $from = me@myaddress.com"; $subject = "Test"; $to =...
7
by: Joe | last post by:
I have an upload file operation in the web application. UploadForm.asp is the form, and UploadAction.asp is the form processing. //UploadForm.asp <FORM NAME="InputForm"...
4
by: Trint Smith | last post by:
Is there a way to hid your web page name and content when a person is viewing your site? Thanks, Trint .Net programmer trintsmith@hotmail.com *** Sent via Developersdex...
3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
5
by: David Thielen | last post by:
Hi; We have our app up on a beta server. Sometimes people from outside the firewall get "The page cannot be displayed" when they try to access it. A couple of weird things about this: 1) If...
2
by: satnamsarai | last post by:
Using System.Net.Mail: Sometimes I get error 'failure sending mail. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.' Not sure how...
3
by: Astha | last post by:
Hello All ! I am new to ASP.Net.I have made a web based application .Now i want to run it in my LAN.But i cant do so.The page cannot be displayed when i provide my computer's IP address and the...
7
by: undbund | last post by:
Hi I am creating a newsletter system. The software should run from desktop computer (localhost) but be able to send email to anyone on the internet. Can you guys give me some ideas on how to...
2
by: =?ISO-8859-1?B?RulybmFz?= | last post by:
Hey all, I have a URGENT problem and I hope someone could help me... scenery: I have a windows app, coded using C# (framework 1.1 - VS2003)... The exe and dlls of the app is are stored in a...
5
vivekgs2007
by: vivekgs2007 | last post by:
Hi sir, I Have created a feedback page in php.Its all working properly.but the problem is that, when any one give the feedback it stores in database, but a mail is not sent to owner...is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.