php mailer pour serveur UNIX - besoin d'un pour Windows Server

  • beaner
  • Novice
  • Novice
  • No Avatar
  • Inscription: Déc 09, 2009
  • Messages: 15
  • Status: Offline

Message Janvier 27th, 2010, 1:17 pm

Salut tous,
J'ai un code php mailer qui envoie un courriel html automatiquement. Il fonctionne à merveille sur deux de mes sites mais pas pour travailler sur le troisième je l'ai mis en place pour. S'avère que le dernier site est sur le serveur Windows a et les deux autres étaient des serveurs Unix. Toute idée de comment changer le code suivant pour qu'il fonctionne sur le serveur Windows?
Code: [ Select ]
<?php
$fname = substr($_POST[fname], 0, 100);
$name = substr($_POST[name], 0, 100);
$address = substr($_POST[address], 0, 100);
$city = substr($_POST[city], 0, 100);
$province = substr($_POST[province], 0, 100);
$postalcode = substr($_POST[postalcode], 0, 100);
$phone = substr($_POST[phone], 0, 100);
$email = substr($_POST[email], 0, 100);
$needle_size = $_POST['needle_size'];
$msg = substr($_POST[message], 0, 800);



if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
{
include 'penfine_error2.htm';
exit;
}

if (empty($_POST[fname]))
{
include 'penfine_error2.htm';
exit;
}
if (empty($_POST[name]))
{
include 'penfine_error2.htm';
exit;
}

//define the receiver of the email
$to = $email;
//define the subject of the email
$subject = 'Penfine Coupon Request';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: ";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.



ob_start(); //Turn on output buffering
?>
--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Thank you for your interest in Penfine.

Please click on the link below to receive your in-store coupon.
Print out the coupon and bring it with you to a participating pharmacy.

PenfineCoupon.pdf

Please do not hesitate to contact us at anytime should you have any further questions.
We look forward to hearing from you!

Kind Regards,

Staff at Auto Control Medical


--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<html>
<head>
<title>Penfine Coupon Request</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-size: 11px}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; }
-->
</style>
</head>
<body>
<div><img src="http://images/emailHeader.jpg" width="640" height="89"></div><br/>
 <p><span class="style1"><span class="style2"><strong>Thank you for your interest in iTest DISQ. 
  </strong><br>
 <br>
Please click on the link below to receive your in-store coupon. <br>
Print out the coupon and bring it with you to a participating pharmacy.<br>
 <br>
 <a href="http://PenfineCoupon.pdf" target="_blank">CLICK HERE TO RECIEVE YOUR PENFINE COUPON</a></span></span><br/>
 </p>
<p class="style3"> Please do not hesitate to contact us at anytime should you have any further questions.<BR>
 We look forward to hearing from you! </span></span></p>




</body>
</html>

--PHP-alt-<?php echo $random_hash; ?>--
<?
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();


//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"


include 'penfine_ICOM_thanks.htm';
include 'data/PenfineICOMQuery.php';
?>
  1. <?php
  2. $fname = substr($_POST[fname], 0, 100);
  3. $name = substr($_POST[name], 0, 100);
  4. $address = substr($_POST[address], 0, 100);
  5. $city = substr($_POST[city], 0, 100);
  6. $province = substr($_POST[province], 0, 100);
  7. $postalcode = substr($_POST[postalcode], 0, 100);
  8. $phone = substr($_POST[phone], 0, 100);
  9. $email = substr($_POST[email], 0, 100);
  10. $needle_size = $_POST['needle_size'];
  11. $msg = substr($_POST[message], 0, 800);
  12. if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
  13. {
  14. include 'penfine_error2.htm';
  15. exit;
  16. }
  17. if (empty($_POST[fname]))
  18. {
  19. include 'penfine_error2.htm';
  20. exit;
  21. }
  22. if (empty($_POST[name]))
  23. {
  24. include 'penfine_error2.htm';
  25. exit;
  26. }
  27. //define the receiver of the email
  28. $to = $email;
  29. //define the subject of the email
  30. $subject = 'Penfine Coupon Request';
  31. //create a boundary string. It must be unique
  32. //so we use the MD5 algorithm to generate a random hash
  33. $random_hash = md5(date('r', time()));
  34. //define the headers we want passed. Note that they are separated with \r\n
  35. $headers = "From: ";
  36. //add boundary string and mime type specification
  37. $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
  38. //define the body of the message.
  39. ob_start(); //Turn on output buffering
  40. ?>
  41. --PHP-alt-<?php echo $random_hash; ?> 
  42. Content-Type: text/plain; charset="iso-8859-1"
  43. Content-Transfer-Encoding: 7bit
  44. Thank you for your interest in Penfine.
  45. Please click on the link below to receive your in-store coupon.
  46. Print out the coupon and bring it with you to a participating pharmacy.
  47. PenfineCoupon.pdf
  48. Please do not hesitate to contact us at anytime should you have any further questions.
  49. We look forward to hearing from you!
  50. Kind Regards,
  51. Staff at Auto Control Medical
  52. --PHP-alt-<?php echo $random_hash; ?> 
  53. Content-Type: text/html; charset="iso-8859-1"
  54. Content-Transfer-Encoding: 7bit
  55. <html>
  56. <head>
  57. <title>Penfine Coupon Request</title>
  58. <style type="text/css">
  59. <!--
  60. .style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
  61. .style2 {font-size: 11px}
  62. .style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; }
  63. -->
  64. </style>
  65. </head>
  66. <body>
  67. <div><img src="http://images/emailHeader.jpg" width="640" height="89"></div><br/>
  68.  <p><span class="style1"><span class="style2"><strong>Thank you for your interest in iTest DISQ. 
  69.   </strong><br>
  70.  <br>
  71. Please click on the link below to receive your in-store coupon. <br>
  72. Print out the coupon and bring it with you to a participating pharmacy.<br>
  73.  <br>
  74.  <a href="http://PenfineCoupon.pdf" target="_blank">CLICK HERE TO RECIEVE YOUR PENFINE COUPON</a></span></span><br/>
  75.  </p>
  76. <p class="style3"> Please do not hesitate to contact us at anytime should you have any further questions.<BR>
  77.  We look forward to hearing from you! </span></span></p>
  78. </body>
  79. </html>
  80. --PHP-alt-<?php echo $random_hash; ?>--
  81. <?
  82. //copy current buffer contents into $message variable and delete current output buffer
  83. $message = ob_get_clean();
  84. //send the email
  85. $mail_sent = @mail( $to, $subject, $message, $headers );
  86. //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
  87. include 'penfine_ICOM_thanks.htm';
  88. include 'data/PenfineICOMQuery.php';
  89. ?>
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Janvier 27th, 2010, 1:17 pm

  • Don2007
  • Web Master
  • Web Master
  • No Avatar
  • Inscription: Nov 21, 2006
  • Messages: 4924
  • Loc: NY
  • Status: Offline

Message Janvier 27th, 2010, 2:29 pm

http://forums.webhostingdiscussion.net/ ... 588.0.html

Lire le premier billet.
How do you know when a politician is lying? His mouth is moving.

Afficher de l'information

  • Total des messages de ce sujet: 2 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 164 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC