Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2005
    Location
    Norway
    Posts
    391

    Advanced Mail form - Not working, help!

    Hi,

    I have been having problems with this mail form for quite a long time now, and cant understand why it doesnt work..

    Simply explained.. This is a order form I use for PayPal, 2Checkout and Mail payments. User are asked to enter name, adress, phone number, and from a drop down menu they can choose for example plan 1, plan 2, plan 3 etc. and some radio buttons they can choose from PayPal, 2Checkout or Mail payment.

    This generated a uniqe number, which I call reference number.

    A copy of the details that the user has entered are supposed to be mailed to the user as a reciept, aswell as to the admin... but this doesnt seem to work.. it doesnt send anything!

    Since its 2 mails being sendt out I did 2 mail() functions within the same file, which I now have tried to skip that, and rather have the 2 mail functions within 2 included files which I have included at the bottom of the script. Hope anyone can help me, or lead me in the right direction. I reallly need this to work.. it just doesnt send any mail.. but the order form works excellent except for that.











    Here is my "purchase.htm" - this is the form file:.





    <? include ("vars.php"); ?>
    <html>
    <head>
    <title>Order Form</title>
    <style>
    body, td, center, p {font-family: verdana, arial, helvetica; font-size: 13px; color: #000000}
    A:link {
    text-decoration: underline: none; none; color:#000000
    }
    A:visited {
    text-decoration: underline: none; none; color:#000000
    }
    A:hover {
    text-decoration: underline; font-weight: none;color:#0000FF;
    }
    .linkTable
    {
    PADDING-center: 5px
    }
    </style>
    <script language="javaScript">
    <!--
    function DoConfirm(message,url) {
    if(confirm(message)) location.href = url;
    }
    // -->
    </script>
    </head>
    <body>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <b>&nbsp;<font face="Verdana" size="4">company.net</font></b><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <b>Order Form</b><br>
    </p>
    <form name="pay" method="post" action="sendpay.php">
    <input type="hidden" name="date" value="<? echo date("l dS of F"); ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td align="center" valign="top"></td>
    <td><b><u>General Information</u></b></td>
    </tr>
    <tr>
    <td width="25%" align="center" valign="top">First Name: <font color="#FF0000">*</font></td>
    <td width="75%"><input name="name" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Last Name: <font color="#FF0000">*</font></td>
    <td><input name="last_name" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Email Address: <font color="#FF0000">*</font></td>
    <td><input name="email" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Address 1: <font color="#FF0000">*</font></td>
    <td><input name="address_1" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Address 2: <font color="#FF0000">*</font></td>
    <td><input name="address_2" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">City: <font color="#FF0000">*</font></td>
    <td><input name="city" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">State: <font color="#FF0000">*</font></td>
    <td><input name="state" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Zip Code: <font color="#FF0000">*</font></td>
    <td><input name="zipcode" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Country: <font color="#FF0000">*</font></td>
    <td><select name="country">
    <option value="">-- Please Select --</option>
    <option value='US'>United States</option>
    <option value='AF'>Afghanistan</option>
    <option value='AL'>Albania</option>
    <option value='DZ'>Algeria</option>
    <option value='AS'>American Samoa</option>
    <option value='AD'>Andorra</option>
    <option value='AO'>Angola</option>
    <option value='AI'>Anguilla</option>
    <option value='AQ'>Antarctica</option>
    <option value='AG'>Antigua And Barbuda</option>
    <option value='AR'>Argentina</option>
    <option value='AM'>Armenia</option>
    <option value='AW'>Aruba</option>
    <option value='AU'>Australia</option>
    <option value='AT'>Austria</option>
    <option value='AZ'>Azerbaijan</option>
    <option value='BS'>Bahamas</option>
    <option value='BH'>Bahrain</option>
    <option value='BD'>Bangladesh</option>
    <option value='BB'>Barbados</option>
    <option value='BY'>Belarus</option>
    <option value='BE'>Belgium</option>
    <option value='BZ'>Belize</option>
    <option value='BJ'>Benin</option>
    <option value='BM'>Bermuda</option>
    <option value='BT'>Bhutan</option>
    <option value='BO'>Bolivia</option>
    <option value='BA'>Bosnia Hercegovina</option>
    <option value='BW'>Botswana</option>
    <option value='BV'>Bouvet Island</option>
    <option value='BR'>Brazil</option>
    <option value='BN'>Brunei Darussalam</option>
    <option value='BG'>Bulgaria</option>
    <option value='BF'>Burkina Faso</option>
    <option value='BI'>Burundi</option>
    <option value='KH'>Cambodia</option>
    <option value='CM'>Cameroon</option>
    <option value='CA'>Canada</option>
    <option value='CV'>Cape Verde</option>
    <option value='KY'>Cayman Islands</option>
    <option value='CF'>Central African Republic</option>
    <option value='TD'>Chad</option>
    <option value='CL'>Chile</option>
    <option value='CN'>China</option>
    <option value='CX'>Christmas Island</option>
    <option value='CC'>Cocos (Keeling) Islands</option>
    <option value='CO'>Colombia</option>
    <option value='KM'>Comoros</option>
    <option value='CG'>Congo</option>
    <option value='CK'>Cook Islands</option>
    <option value='CR'>Costa Rica</option>
    <option value='CI'>Cote D'Ivoire</option>
    <option value='HR'>Croatia</option>
    <option value='CU'>Cuba</option>
    <option value='CY'>Cyprus</option>
    <option value='CZ'>Czech Republic</option>
    <option value='CS'>Czechoslovakia</option>
    <option value='DK'>Denmark</option>
    <option value='DJ'>Djibouti</option>
    <option value='DM'>Dominica</option>
    <option value='DO'>Dominican Republic</option>
    <option value='TP'>East Timor</option>
    <option value='EC'>Ecuador</option>
    <option value='EG'>Egypt</option>
    <option value='SV'>El Salvador</option>
    <option value='GB'>England</option>
    <option value='GQ'>Equatorial Guinea</option>
    <option value='ER'>Eritrea</option>
    <option value='EE'>Estonia</option>
    <option value='ET'>Ethiopia</option>
    <option value='FK'>Falkland Islands (Malvinas)</option>
    <option value='FO'>Faroe Islands</option>
    <option value='FJ'>Fiji</option>
    <option value='FI'>Finland</option>
    <option value='FR'>France</option>
    <option value='FX'>France, Metropolitan</option>
    <option value='GF'>French Guiana</option>
    <option value='PF'>French Polynesia</option>
    <option value='TF'>French Southern Territories</option>
    <option value='GA'>Gabon</option>
    <option value='GM'>Gambia</option>
    <option value='GE'>Georgia</option>
    <option value='DE'>Germany</option>
    <option value='GH'>Ghana</option>
    <option value='GI'>Gibraltar</option>
    <option value='GB'>Great Britain</option>
    <option value='GR'>Greece</option>
    <option value='GL'>Greenland</option>
    <option value='GD'>Grenada</option>
    <option value='GP'>Guadeloupe</option>
    <option value='GU'>Guam</option>
    <option value='GT'>Guatemela</option>
    <option value='GG'>Guernsey</option>
    <option value='GN'>Guinea</option>
    <option value='GW'>Guinea-Bissau</option>
    <option value='GY'>Guyana</option>
    <option value='HT'>Haiti</option>
    <option value='HM'>Heard and McDonald Islands</option>
    <option value='HN'>Honduras</option>
    <option value='HK'>Hong Kong</option>
    <option value='HU'>Hungary</option>
    <option value='IS'>Iceland</option>
    <option value='IN'>India</option>
    <option value='ID'>Indonesia</option>
    <option value='IR'>Iran</option>
    <option value='IQ'>Iraq</option>
    <option value='IE'>Ireland</option>
    <option value='IM'>Isle Of Man</option>
    <option value='IL'>Israel</option>
    <option value='IT'>Italy</option>
    <option value='JM'>Jamaica</option>
    <option value='JP'>Japan</option>
    <option value='JE'>Jersey</option>
    <option value='JO'>Jordan</option>
    <option value='KZ'>Kazakhstan</option>
    <option value='KE'>Kenya</option>
    <option value='KI'>Kiribati</option>
    <option value='KR'>Korea, Republic Of</option>
    <option value='KW'>Kuwait</option>
    <option value='KG'>Kyrgyzstan</option>
    <option value='LV'>Latvia</option>
    <option value='LB'>Lebanon</option>
    <option value='LS'>Lesotho</option>
    <option value='LR'>Liberia</option>
    <option value='LY'>Libyan Arab Jamahiriya</option>
    <option value='LI'>Liechtenstein</option>
    <option value='LT'>Lithuania</option>
    <option value='LU'>Luxembourg</option>
    <option value='MO'>Macau</option>
    <option value='MK'>Macedonia</option>
    <option value='MG'>Madagascar</option>
    <option value='MW'>Malawi</option>
    <option value='MY'>Malaysia</option>
    <option value='MV'>Maldives</option>
    <option value='ML'>Mali</option>
    <option value='MT'>Malta</option>
    <option value='MH'>Marshall Islands</option>
    <option value='MQ'>Martinique</option>
    <option value='MR'>Mauritania</option>
    <option value='MU'>Mauritius</option>
    <option value='YT'>Mayotte</option>
    <option value='MX'>Mexico</option>
    <option value='MD'>Moldova</option>
    <option value='MC'>Monaco</option>
    <option value='MN'>Mongolia</option>
    <option value='MS'>Montserrat</option>
    <option value='MA'>Morocco</option>
    <option value='MZ'>Mozambique</option>
    <option value='MM'>Myanmar</option>
    <option value='NA'>Namibia</option>
    <option value='NR'>Nauru</option>
    <option value='NP'>Nepal</option>
    <option value='NL'>Netherlands</option>
    <option value='AN'>Netherlands Antilles</option>
    <option value='NT'>Neutral Zone</option>
    <option value='NC'>New Caledonia</option>
    <option value='NZ'>New Zealand</option>
    <option value='NI'>Nicaragua</option>
    <option value='NE'>Niger</option>
    <option value='NG'>Nigeria</option>
    <option value='NU'>Niue</option>
    <option value='NF'>Norfolk Island</option>
    <option value='MP'>Northern Mariana Islands</option>
    <option value='NO'>Norway</option>
    <option value='OM'>Oman</option>
    <option value='PK'>Pakistan</option>
    <option value='PW'>Palau</option>
    <option value='PS'>Palestine</option>
    <option value='PA'>Panama</option>
    <option value='PG'>Papua New Guinea</option>
    <option value='PY'>Paraguay</option>
    <option value='PE'>Peru</option>
    <option value='PH'>Philippines</option>
    <option value='PN'>Pitcairn</option>
    <option value='PL'>Poland</option>
    <option value='PT'>Portugal</option>
    <option value='PR'>Puerto Rico</option>
    <option value='QA'>Qatar</option>
    <option value='RE'>Reunion</option>
    <option value='RO'>Romania</option>
    <option value='RU'>Russian Federation</option>
    <option value='RW'>Rwanda</option>
    <option value='SH'>Saint Helena</option>
    <option value='KN'>Saint Kitts And Nevis</option>
    <option value='LC'>Saint Lucia</option>
    <option value='PM'>Saint Pierre</option>
    <option value='WS'>Samoa</option>
    <option value='SM'>San Marino</option>
    <option value='ST'>Sao Tome and Principe</option>
    <option value='SA'>Saudi Arabia</option>
    <option value='SN'>Senegal</option>
    <option value='SC'>Seychelles</option>
    <option value='SL'>Sierra Leone</option>
    <option value='SG'>Singapore</option>
    <option value='SK'>Slovakia</option>
    <option value='SI'>Slovenia</option>
    <option value='SB'>Solomon Islands</option>
    <option value='SO'>Somalia</option>
    <option value='ZA'>South Africa</option>
    <option value='ES'>Spain</option>
    <option value='LK'>Sri Lanka</option>
    <option value='SD'>Sudan</option>
    <option value='SR'>Suriname</option>
    <option value='SJ'>Svalbard</option>
    <option value='SZ'>Swaziland</option>
    <option value='SE'>Sweden</option>
    <option value='CH'>Switzerland</option>
    <option value='SY'>Syrian Arab Republic</option>
    <option value='TW'>Taiwan</option>
    <option value='TJ'>Tajikista</option>
    <option value='TZ'>Tanzania</option>
    <option value='TH'>Thailand</option>
    <option value='TG'>Togo</option>
    <option value='TK'>Tokelau</option>
    <option value='TO'>Tonga</option>
    <option value='TT'>Trinidad and Tobago</option>
    <option value='TN'>Tunisia</option>
    <option value='TR'>Turkey</option>
    <option value='TM'>Turkmenistan</option>
    <option value='TC'>Turks and Caicos Islands</option>
    <option value='TV'>Tuvalu</option>
    <option value='UG'>Uganda</option>
    <option value='UA'>Ukraine</option>
    <option value='AE'>United Arab Emirates</option>
    <option value='UK'>United Kingdom</option>
    <option value='UY'>Uruguay</option>
    <option value='UZ'>Uzbekistan</option>
    <option value='VU'>Vanuatu</option>
    <option value='VA'>Vatican City State</option>
    <option value='VE'>Venezuela</option>
    <option value='VN'>Vietnam</option>
    <option value='VG'>Virgin Islands (British)</option>
    <option value='VI'>Virgin Islands (U.S.)</option>
    <option value='WF'>Wallis and Futuna</option>
    <option value='WG'>West Bank and Gaza</option>
    <option value='EH'>Western Sahara</option>
    <option value='YE'>Yemen, Republic of</option>
    <option value='YU'>Yugoslavia</option>
    <option value='ZR'>Zaire</option>
    <option value='ZM'>Zambia</option>
    <option value='ZW'>Zimbabwe</option>
    </select></td>
    <tr>
    <td align="center" valign="top">Telephone Number: <font color="#FF0000">*</font></td>
    <td><input name="telephone_number" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Fax Number:</td>
    <td><input name="fax_number" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top"></td>
    <td><br><b><u>Account Information</u></b></td>
    </tr>
    <tr>
    <td align="center" valign="top">Username: <font color="#FF0000">*</font></td>
    <td><input name="username" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Password: <font color="#FF0000">*</font></td>
    <td><input name="password" type="password" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Product: <font color="#FF0000">*</font></td>
    <td><select name="plan"><option value="">-- Please Select --
    <option value="Plan1"> Plan1<option value="Plan2"> Plan2
    <option value="Plan3"> Plan3<option value="Plan4"> Plan4</select></td>
    </tr>
    <tr>
    <td align="center" valign="top">Payment Method: <font color="#FF0000">*</font></td>
    <td>
    <input name="pay_method" type="radio" value="mail"> <a href="javascript:void(0)" onclick="open('direct.php','newwin','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=600,height=300')">
    <img src="images/mail.gif" border="0" width="78" height="26"></a>
    <br><input name="pay_method" type="radio" value="paypal"> <a target="_blank" href="http://www.paypal.com">
    <img src="images/paypal.gif" border="0" width="81" height="26"></a>
    <br><input name="pay_method" type="radio" value="2checkout"> <a target="_blank" href="http://www.2checkout.com">
    <img src="images/2checkout.gif" border="0" width="78" height="26"></a>
    </td>
    </tr>
    <tr>
    <td align="center" valign="top"></td>
    <td><br><b><u>Terms and Conditions</u></b></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="<? echo $terms; ?>" target="_blank">Terms and Conditions</a>: <font color="#FF0000">*</font></td>
    <td><input name="terms" type="checkbox" value="iagree"> I agree to the Terms and Conditions.</td>
    </tr>
    <tr>
    <td align="center" valign="top"></td>
    <td><br><b><u>Other</u></b></td>
    </tr>
    <tr>
    <td align="center" valign="top">How You Found Us:</td>
    <td><input name="found_you" type="text" size="40"></td>
    </tr>
    <tr>
    <td align="center" valign="top">Additional Information:</td>
    <td><textarea name="additional_information" cols="40" rows="5"></textarea></td>
    </tr>
    <tr>
    <td align="left" valign="top">&nbsp;</td>
    <td><input type="submit" value="&nbsp;&nbsp;Sign Up&nbsp;&nbsp;"> <input type="reset" value="&nbsp;&nbsp;Reset&nbsp;&nbsp;"> <input type="button" value="&nbsp;&nbsp;Cancel&nbsp;&nbsp;" onClick="javascriptoConfirm('Are you sure you want to cancel?\n\nPlease Note: Your details will not be saved!','<? echo $site; ?>')"></td>
    </tr>
    </table>
    <input type="hidden" name="reference_code" value="<? srand(); print rand(); ?>">
    <input type="hidden" name="ip" value="<? echo $_SERVER["REMOTE_ADDR"]; ?>&nbsp;</form>
    <br>
    <center>
    <b>Please Note:</b> Required fields are marked with a <font color="#FF0000">*</font>
    <hr>
    <img src="images/ssl.gif" border="0" width="12" height="17"> This form is SSL Secured.
    </center>
    </body>
    </html>
















    Here is "sendpay.php":


    <?PHP


    $plan_1 = "Plan1";
    $plan_2 = "Plan2";
    $plan_3 = "Plan3";
    $plan_4 = "Plan4";
    $opt1 = "mail";
    $opt2 = "paypal";
    $opt3 = "2checkout";

    if($plan==$plan_1) {

    if($pay_method==$opt1) {
    include("ffh_buynow_mail.php");
    exit;
    }
    if($pay_method==$opt2) {
    include("ffh_buynow_paypal.php"); // this file redirect to PayPal if $opt2 is paypal
    exit;
    }
    if($pay_method==$opt3) {
    include("ffh_buynow_2checkout.php");
    exit;
    }

    }

    if($plan==$plan_2) {

    if($pay_method==$opt1) {
    include("fs_buynow_mail.php");
    exit;
    }
    if($pay_method==$opt2) {
    include("fs_buynow_paypal.php");
    exit;
    }
    if($pay_method==$opt3) {
    include("fs_buynow_2checkout.php");
    exit;
    }

    }

    if($plan==$plan_3) {

    if($pay_method==$opt1) {
    include("fm_buynow_mail.php");
    exit;
    }
    if($pay_method==$opt2) {
    include("fm_buynow_paypal.php");
    exit;
    }
    if($pay_method==$opt3) {
    include("fm_buynow_2checkout.php");
    exit;
    }

    }

    if($plan==$plan_4) {

    if($pay_method==$opt1) {
    include("3in1_buynow_mail.php");
    exit;
    }
    if($pay_method==$opt2) {
    include("3in1_buynow_paypal.php");
    exit;
    }
    if($pay_method==$opt3) {
    include("3in1_buynow_2checkout.php");
    exit;
    }

    }

    include("mailer1.php"); // this is supposed to send admin (me) a note with the info
    include("mailer2.php"); // this is supposed to send user their info


    ?>











    This is "Mailer1.php":



    <?php
    $alt_email="[email protected]";

    $recipient=$alt_email;

    $subject="New Order $reference_code";

    $msg = "Purchase \n\nBuyers Details:\n\n First Name: $name\n Last Name: $last_name\n Email: $email\n Address 1: $adress_1\n Address 2: $adress_2\n City: $city\n State: $state\n ZIP Code: $zipcode\n Country: $country\n Telephone # : $telephone_number\n $fax_number\n\n Username: $username\n Password: $password\n Script: $plan\n Payment method: $pay_method\n Agreed to terms: $terms\n How he found us: $found_you\n Additional Information: $additional_information\n\n Reference Code: $reference_code\n\n IP: $ip\n DATE: $date\n";

    $mailheaders="From: New Order <[email protected]>\n";

    mail ($recipient, $subject, $msg, $mailheaders);


    ?>








    This is "mailer2.php":


    <?php
    $recipient=$email;

    $subject="Order $reference_code Recieved";

    $msg = "Purchase - Your order $reference_code has been recieved \n\nYour Details:\n\n First Name: $name\n Last Name: $last_name\n Email: $email\n Address 1: $adress_1\n Address 2: $adress_2\n City: $city\n State: $state\n ZIP Code: $zipcode\n Country: $country\n Telephone # : $telephone_number\n $fax_number\n\n Username: $username\n Password: $password\n Script: $plan\n Payment method: $pay_method\n Additional Information: $additional_information\n\n Reference Code: $reference_code (Please write this down for further reference)\n\nDATE: $date\n\n You should recieve further details regarding your order and a download link to your purchased item within 24-48 Hours\n Thanks for shopping with us!\n\n Best Regards,\n CompanyName.";

    $mailheaders="From: Sales Department <[email protected]>\n";

    mail ($recipient, $subject, $msg, $mailheaders);


    ?>













    "Sendpay.php" - just checks what plan the user has chosen, also what payment method the user has chosen. On submit, if they chose paypal and plan1, the user gets redirected to paypal and asked to pay the amount of what plan1 costs. Same with other plans and 2Checkout.

    "Purchase.htm" - this are the form that POST all the info to "sendpay.php".

    "mailer1.php" - this are supposed to send me a note with all info fromo the users in my mail.

    "mailer2.php" - this are supposed to send the users a note with their info in their mail.







    Really hope anyone can help me out and find out why this form doesnt send a mail to me and the user after it has been submitted.

    The form works excellent for the payment part, but all the info the user type are useless, as I nor them recieve any of it in the mail as its supposed to.

  2. #2
    Join Date
    Apr 2005
    Posts
    42
    Create a test page and fill in your email address as indicated below.

    PHP Code:
    if(mail("[email protected]"'TESTING'"TESTING") == true)
         echo 
    "Sent Successfully";
    else
         echo 
    "Failed"
    what is printed out?

    and

    did you get the mail if it printed out Sent Successfully???
    Last edited by Insert_Name_Here; 04-25-2005 at 08:24 AM.

  3. #3
    Join Date
    Feb 2005
    Location
    Norway
    Posts
    391
    Hey m8!

    First of all, thanks for taking time to read all that.


    I think you put me on the track for a solution...


    Old sendpay.php was

    if($pay_method==$opt1) {
    include("fs_buynow_2checkout.php");
    exit;
    }

    include("mailer1.php");
    include("mailer2.php");



    But this appeared to start the redirection in fs_buynow_2checkout.php before the mail was sendt!

    But I still cant send an email, atleast not with headers, like From:, which are required for my mail client to recieve the mail.

    Says:

    Warning: Cannot modify header information - headers already sent by (output started at /home/ulow/public_html/mailer1.php:14) in /home/ulow/public_html/fs_buynow_2checkout.php on line 2





    Heres mailer1.php:


    <?php
    $alt_email="[email protected]";

    $recipient=$alt_email;

    $subject="New Order $reference_code";

    $msg = "Purchase \n\nBuyers Details:\n\n First Name: $name\n Last Name: $last_name\n Email: $email\n Address 1: $adress_1\n Address 2: $adress_2\n City: $city\n State: $state\n ZIP Code: $zipcode\n Country: $country\n Telephone # : $telephone_number\n $fax_number\n\n Username: $username\n Password: $password\n Script: $plan\n Payment method: $pay_method\n Agreed to terms: $terms\n How he found us: $found_you\n Additional Information: $additional_information\n\n Reference Code: $reference_code\n\n IP: $ip\n DATE: $date\n";

    $mailheaders="From: New Order <[email protected]>\n";

    mail ($recipient, $subject, $msg, $mailheaders);


    ?>




    And this is fs_buynow_2checkout.php:


    <?php
    header('Location: https://www.2checkout.com/cgi-bin/cc...XX&quantity=XX);
    ?>



    Is there any way around this?
    So both the redirection in fs_buynow_2checkout.php can be done, aswell as sending the headers in the email?

    Thanks.

  4. #4
    Join Date
    Feb 2005
    Location
    Norway
    Posts
    391
    Oke now my sendpay.php look like this:

    if($pay_method==$opt1) {
    include("mailer1.php");
    include("mailer2.php");
    include("fs_buynow_2checkout.php");
    exit;
    }


    The difference now is...

    I include the mailer1.php and mailer2.php files before I include the file who redirect. This works.. and this sends a mail.. but then the form again isnt working.. and giving me error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/ulow/public_html/mailer1.php:14) in /home/ulow/public_html/fs_buynow_2checkout.php on line 2


    These headers who are already sent... could these be the ones in the email script? The From: part..?

    Any way I can get around this?


    Any help apprecciated

  5. #5
    Join Date
    Apr 2005
    Posts
    42
    tried.

    PHP Code:
    $recipient="[email protected]";

    $subject="Test";

    $msg "Test";

    $mailheaders="From: New Order <[email protected]>\n";

    mail ($recipient$subject$msg$mailheaders);

    header("Location: http://www.google.com");
    ?> 

    and it works fine.

    Are you printing any text anything at all before you get to the header line?????? If you are it will not work...
    Last edited by Insert_Name_Here; 04-25-2005 at 11:47 AM.

  6. #6
    Join Date
    Feb 2005
    Location
    Norway
    Posts
    391
    hey,

    No im not printing any text first.

    But the problem is there is really many redirect pages I want to redirect people to.

    Not only a few.

    Which would probably send many mails?

    Thanks for your reply

  7. #7
    Join Date
    Apr 2005
    Posts
    42
    You have posted the code here, but could you zip those files up and send them to me, whatever you have currently????

    Post up your email and I will email you, or send me a private message.

  8. #8
    Join Date
    Apr 2005
    Posts
    42
    I have not run this so you might have to debug it.

    Create a new file called mailer.php and put this in it.

    *******************mailer.php start***************
    PHP Code:
    function send_mail($recipient$subject$msg$mailheaders)
    {
        
    mail($recipient$subject$msg$mailheaders);

    *******************mailer.php end***************

    Now make a backup of sendpay.php, and then copy this into sendpay.php.

    *******************sendpay.php start***************
    PHP Code:
    <?PHP
    include("mailer.php");

    $plan_1 "1000Mb";
    $plan_2 "3000Mb";
    $plan_3 "5000Mb";
    $plan_4 "8000Mb";
    $opt1 "mail";
    $opt2 "paypal";
    $opt3 "2checkout";

    $reference_code $_POST["reference_code"];
    $name $_POST["name"];
    $last_name $_POST["last_name"];
    $email $_POST["email"];
    $adress_1 $_POST["adress_1"];
    $adress_2 $_POST["adress_2"];
    $city $POST["city"];
    $state $_POST["state"];
    $zipcode $_POST["zipcode"];
    $country $_POST["country"];
    $telephone_number $_POST["telephone_number"];
    $fax_number $_POST["fax_number"];
    $username $_POST["username"];
    $password $_POST["password"];
    $plan $_POST["plan"];
    $additional_information $_POST["additional_information"];

    //just a better way of getting the IP
    $ip $_SERVER['REMOTE_ADDR'];

    //Put in own date format preference
    $date date("F j, Y, g:i a");


    $recipient_admin "[email protected]";
    $subject_admin "New Order $reference_code";
    $msg_admin "Purchase $reference_code\n\nBuyers Details:\n\n First Name: $name\n Last Name: $last_name\n Email: $email\n Address 1: $adress_1\n Address 2: $adress_2\n City: $city\n State: $state\n ZIP Code: $zipcode\n Country: $country\n Telephone # : $telephone_number\n $fax_number\n\n Username: $username\n Password: $password\n Script: $plan\n Payment method: $pay_method\n Agreed to terms: $terms\n How he found us: $found_you\n Additional Information: $additional_information\n\n Reference Code: $reference_code\n\n IP: $ip\n DATE: $date\n";
    $mailheaders_admin "From:  New Order <[email protected]>\n";


    $recipient_customer $email;
    $subject_customer "Order $reference_code Recieved";
    $mailheaders_customer "From:  Sales Department <[email protected]>\n";
    $msg_customer "Your order $reference_code has been recieved \n\nYour Details:\n\n First Name: $name\n Last Name: $last_name\n Email: $email\n Address 1: $adress_1\n Address 2: $adress_2\n City: $city\n State: $state\n ZIP Code: $zipcode\n Country: $country\n Telephone # : $telephone_number\n $fax_number\n\n Username: $username\n Password: $password\n Script: $plan\n Payment method: $pay_method\n Additional Information: $additional_information\n\n Reference Code: $reference_code (Please write this down for further reference)\n\nDATE: $date\n\n You should recieve further details regarding your order and a download link to your purchased item within 24-48 Hours\n Thanks for shopping with us!\n\n Best Regards,\n CompanyName.";



    send_mail($recipient_admin$subject_admin$msg_admin$mailheaders_admin);
    send_mail($recipient_customer $subject_customer $msg_customer $mailheaders_customer );


    if(
    $plan==$plan_1) {

    if(
    $pay_method==$opt1) {
    include(
    "ffh_buynow_mail.php");
    exit;
    }
    if(
    $pay_method==$opt2) {
    include(
    "ffh_buynow_paypal.php");
    exit;
    }
    if(
    $pay_method==$opt3) {
    include(
    "ffh_buynow_2checkout.php");
    exit;
    }

    }

    if(
    $plan==$plan_2) {

    if(
    $pay_method==$opt1) {
    include(
    "fs_buynow_mail.php");
    exit;
    }
    if(
    $pay_method==$opt2) {
    include(
    "fs_buynow_paypal.php");
    exit;
    }
    if(
    $pay_method==$opt3) {
    include(
    "fs_buynow_2checkout.php");
    exit;
    }

    }

    if(
    $plan==$plan_3) {

    if(
    $pay_method==$opt1) {
    include(
    "fm_buynow_mail.php");
    exit;
    }
    if(
    $pay_method==$opt2) {
    include(
    "fm_buynow_paypal.php");
    exit;
    }
    if(
    $pay_method==$opt3) {
    include(
    "fm_buynow_2checkout.php");
    exit;
    }

    }

    if(
    $plan==$plan_4) {

    if(
    $pay_method==$opt1) {
    include(
    "3in1_buynow_mail.php");
    exit;
    }
    if(
    $pay_method==$opt2) {
    include(
    "3in1_buynow_paypal.php");
    exit;
    }
    if(
    $pay_method==$opt3) {
    include(
    "3in1_buynow_2checkout.php");
    exit;
    }

    }

    ?>
    *******************sendpay.php end***************


    that should be it.

  9. #9
    Join Date
    Apr 2005
    Posts
    42
    Lastly I see you have ip and date in your form so that can be left at

    PHP Code:
    $ip $_POST['ip']; 
    $date $_POST['date']; 

  10. #10
    Join Date
    Feb 2005
    Location
    Norway
    Posts
    391
    Hey, thanks alot man, that musta taken long time to write all that.
    tho 10 min after testing I still havent gotten the mail, it may only be slow tho. Thanks again m8, I owe you

  11. #11
    Join Date
    Apr 2005
    Posts
    42
    Just make absolutely sure it is sending the mail to the right address.

    replace this:

    PHP Code:
    send_mail($recipient_admin$subject_admin$msg_admin$mailheaders_admin); 
    send_mail($recipient_customer $subject_customer $msg_customer $mailheaders_customer ); 
    with
    PHP Code:

    echo "sending mail 1 to $recipient_admin and sending mail 2 to $recipient_customer";
    exit();
    //send_mail($recipient_admin, $subject_admin, $msg_admin, $mailheaders_admin); 
    //send_mail($recipient_customer , $subject_customer , $msg_customer , $mailheaders_customer ); 
    I could send those mails fine from my system, so if you tried this

    PHP Code:
    if(mail("[email protected]"'TESTING'"TESTING") == true
         echo 
    "Sent Successfully"
    else 
         echo 
    "Failed"
    and it worked, then its probably something to do with where you are sending the emails.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •