php mailer for unix server - need one for windows server
- beaner
- Novice


- Joined: Dec 09, 2009
- Posts: 15
- Status: Offline
Hi All,
I have a php mailer code that sends out an html email automatically. It works great on two of my websites but failed to work on the third one I set it up for. Turns out the last site is on a windows server and the other two were unix servers. Any idea how to change the following code so that it works on a windows server?
I have a php mailer code that sends out an html email automatically. It works great on two of my websites but failed to work on the third one I set it up for. Turns out the last site is on a windows server and the other two were unix servers. Any idea how to change the following code so that it works on a windows server?
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';
?>
$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';
?>
- <?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';
- ?>
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
January 27th, 2010, 1:17 pm
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 2 posts
- Users browsing this forum: No registered users and 300 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum

