Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2007
    Location
    Elburn, IL USA
    Posts
    150

    PHP Code Help, Please.

    I have posted the following mail.php file to my website:

    Code:
    <?php 
    
    // send our email 
    mail ("$to","$subject","$body","$from");
    
    ?>
    Here is my input and HTTP.submit:

    [CODE]-- Get values from input fields
    name = Input.GetText("name");
    email_address = Input.GetText("email_address");
    email_subject = Input.GetText("subject");
    message = Input.GetText("message");
    from = noreply@domain.com;
    to = email@domain.com;

    Code:
    -- body of email message
    body = "Name: "..name.."\r\nEmail Address: "..email_address.."\r\nMessage: "..message..";
    
    -- subject line of email message
    subject = ..email_subject;
    
    -- submit message to mail.php
    HTTP.Submit("http://www.domain.com/mail.php,(to=to,subject=subject,body=body,from=from), _POST, 20, 80, nil, nil);

    The "From" shows up in the body of the email as opposed to the "From (Sender)". Can someone help with the mail.php script, please?

  2. #2
    Join Date
    Mar 2004
    Location
    Toronto, ON CANADA
    Posts
    696
    Try these changes. The changes are noted in red text:

    Code:
    from = "noreply@domain.com";
    to = "email@domain.com";
    
    HTTP.Submit("http://www.domain.com/mail.php,{to=to,subject=subject,body=body,from=from}, SUBMITWEB_POST, 20, 80, nil, nil);

  3. #3
    Join Date
    Apr 2007
    Location
    Elburn, IL USA
    Posts
    150
    Tek,

    I made the changes and the senders email address appears like this:

    Apache [apache@snake.tera-byte.com]

    I have the site hosted with tera-byte.com.

    The
    Code:
    from = "email@domain.com";
    appears on the first line in the body of the message as:

    email@domain.com

    What script would I need to add to the mail.php file in order to replace Apache [apache@snake.tera-byte.com] with email@domain.com?

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto, ON CANADA
    Posts
    696
    Our company uses tera-byte.com hosting as well and (as far as I know) the email will appear to come from the account name of the site. I don't know if this can be changed unless something can be done in your php.ini file for your hosting account.

  5. #5
    Join Date
    Apr 2007
    Location
    Elburn, IL USA
    Posts
    150
    I spoke to their support people today, and they said it was possible to change it, and that it would need to be via the mail.php script. I'm looking the script I could add to the mail.php to make it happen. Anybody?

  6. #6
    Join Date
    Mar 2004
    Location
    Toronto, ON CANADA
    Posts
    696
    In that case try adding this line before your mail function in your php file:

    Code:
    $from = "noreply@domain.com";

  7. #7
    Join Date
    Apr 2007
    Location
    Elburn, IL USA
    Posts
    150
    I tried and get the same result. Apache [apache@snake.tera-byte.com] is still showing up as the sender.

    You can see why I want to modify the sender. "Apache" and "snake" in the sender name are not exactly comforting terms to a mail recipient.

    I received another response to my help ticket, and they said it can be done. However, it does need to be done in the mail.php script. Does anyone have a script that deals with this issue?

  8. #8
    Join Date
    Apr 2001
    Location
    Haverhill, Suffolk, UK
    Posts
    360
    Have a look at this - I use it all the time and works brilliantly.

    http://www.dagondesign.com/articles/...mailer-script/

    Rgds John

  9. #9
    Join Date
    Apr 2007
    Location
    Elburn, IL USA
    Posts
    150
    I was able to get the following script to work:

    Code:
    <?php $sendTo = "$to"; 
    $subject = "$subject";
    $headers = "From: noreply@domain.com" ; 
    $headers .= "<noreply@domain.com>\r\n"; 
    $headers .= "Reply-To: Do Not Reply"; 
    $message = "$message";
    mail($sendTo, $subject, $message, $headers);?>
    I hope this helps others!

    And, thanks to all that responded !

  10. #10
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by David REMD View Post
    I was able to get the following script to work:

    Code:
    <?php $sendTo = "$to"; 
    $subject = "$subject";
    $headers = "From: noreply@domain.com" ; 
    $headers .= "<noreply@domain.com>\r\n"; 
    $headers .= "Reply-To: Do Not Reply"; 
    $message = "$message";
    mail($sendTo, $subject, $message, $headers);?>
    I hope this helps others!

    And, thanks to all that responded !
    PHP Code:
    <?php 
    $sig
    =$HTTP_GET_VARS["sig"];
    $sendTo="Rexzooly@vilsoft.co.uk"
    $subject $HTTP_GET_VARS["sb"];
    $headers "From: User: $sig " 
    $headers .= "<noreply@diskhub.info>\r\n"
    $headers .= "You Was Contacted By:\r\n";
    $headers .= $HTTP_GET_VARS["from"]; 
    $message =   $HTTP_GET_VARS["body"];
    mail($sendTo$subject$message$headers);?>
    I am trying to get the Signature to be in the from field and the bottem of
    the body also does anyone know how to do this?

  11. #11
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by rexzooly View Post
    PHP Code:
    <?php 
    $sig
    =$HTTP_GET_VARS["sig"];
    $sendTo="Rexzooly@vilsoft.co.uk"
    $subject $HTTP_GET_VARS["sb"];
    $headers ".$sig." 
    $headers .= "<noreply@diskhub.info>\r\n"
    $headers .= "You Was Contacted By:\r\n";
    $headers .= $HTTP_GET_VARS["from"]; 
    $message =   $HTTP_GET_VARS["body"];
    mail($sendTo$subject$message$headers);?>
    I am trying to get the Signature to be in the from field and the bottem of
    the body also does anyone know how to do this?


    or is it a problem with my code ?
    Code:
    -- clear error variable
    error = 0;
    
    -- Get values from input fields
    from = Input.GetText("Input1");
    subject = Input.GetText("Input2");
    body = Input.GetText("Input3");
    sig = Input.GetText("Input4");
    -- Submit To Server
    tSubmitValues = {
    sb = subject;
    body = body;
    from = from;
    sig = footer;
    }
    
    -- check for empty fields and deliver errors if needed
    if String.Length(sig) < 1 then
    Dialog.Message("Error", " enter Signature Thank you.");
    error = 1;
    end
    if String.Length(from) < 1 then
    Dialog.Message("Error", "Please enter your email address and re-submit. Thank you.");
    error = 1;
    end
    if String.Length(subject) < 1 then
    Dialog.Message("Error", "Please enter your email subject and re-submit. Thank you.");
    error = 1;
    end
    if String.Length(body) < 1 then
    Dialog.Message("Error", "Please enter your email message and re-submit. Thank you.");
    error = 1;
    end
    
    if error~=1 then
    -- if no errors exist, send the email now and give a confirmation dialog
    result = HTTP.Submit("http://diskhub.info/mail2.php", tSubmitValues, SUBMITWEB_GET, 1, 80, nil, nil);
    Dialog.Message("Submit Confirmation", "The Following Data You Just Sent Is: \r\n" .. result);
    Dialog.Message("Thank You", "We Will Get Back To You Shortly\r\n", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    Page.Jump("Home");
    end
    Last edited by rexzooly; 09-18-2007 at 04:26 AM. Reason: new code

Similar Threads

  1. Article: Using Authenticode Code Signing Certificates
    By Ted Sullivan in forum Setup Factory 8.0 Examples
    Replies: 4
    Last Post: 10-31-2007, 09:03 AM
  2. PHP code
    By Bruce in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 05-02-2007, 12:16 AM
  3. Function: Email Any Data Through PHP
    By Brett in forum AutoPlay Media Studio 5.0 Examples
    Replies: 8
    Last Post: 10-02-2004, 08:08 PM
  4. The dreaded Submit to web PHP issue!
    By Bruce in forum AutoPlay Media Studio 4.0
    Replies: 2
    Last Post: 09-19-2003, 03:00 PM

Posting Permissions

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