www.webdeveloper.com
Results 1 to 7 of 7

Thread: invalid_address@.syntax-error -

  1. #1
    Join Date
    Jun 2006
    Location
    Doncaster
    Posts
    78

    invalid_address@.syntax-error -

    Ok, this is a PHP Mail question.

    I have a form, which when processed should send me an email. What I recieve is a slightly stern message informing me about the error above, and none of the information enetered in the form.

    Searching round the forums suggest that the mails server cannot resolve the address- but I can't see if or why that's a problem.

    Any ideas?

    This is the form:
    Code:
    <div id="contact" style="float:right; margin-left:10px; display:inline"><table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr>
    <td><strong>Contact Form </strong></td>
    </tr>
    </table>
    
    <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
    <td><form name="form1" method="post" action="send_message.php">
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
    <tr>
    <td width="16%">Subject</td>
    <td width="2%">:</td>
    <td width="82%"><input name="subject" type="text" id="subject" size="45"></td>
    </tr>
    <tr>
    <td>Detail</td>
    <td>:</td>
    <td><textarea name="detail" cols="35" rows="4" id="detail"></textarea></td>
    </tr>
    <tr>
    <td>Name</td>
    <td>:</td>
    <td><input name="name" type="text" id="name" size="45"></td>
    </tr>
    <tr>
    <td>Email/phone</td>
    <td>:</td>
    <td><input name="customer_mail" type="text" id="customer_mail" size="45"></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    
    </div>
    and this is where it is processed:

    PHP Code:
    <?php
    // Contact subject
    $subject ="$subject"
    // Details
    $message="$detail"

    // Mail of sender
    $mail_from="$customer_mail"
    // From 
    $header="from: $name <$mail_from>"

    // Enter your email address (changed for the forum)
    $to ='ali.hurworth1@mailserver.com'

    $send_message=mail($to,$subject,$message,$header);

    // Check, if message sent to your email 
    // display message "We've recieved your information"
    if($send_message){
    echo 
    "Thanks: I'll get back to you as soon as I can!";
    }
    else {
    echo 
    "There seems to have been a problem. Please phone or text instead?";
    }
    ?>
    Notably, I never get the fallback message.

    Has anyone got any clues?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,154
    Many mail servers are configured to allow mail to only be sent with "From:" header which is a valid email address on that server. Therefore you may have to change your from address to your email address on that server, then add a "Reply-To:" header for the user's email address.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2006
    Location
    Doncaster
    Posts
    78
    Hi NogDog,

    In the end I ttok your advice and changed the code to reflect that. Also, I saw that the php should have referred to:

    $subject =$_POST["subject"];
    to set the variables.
    Thanks again for the advice!

  4. #4
    Join Date
    Mar 2010
    Posts
    1
    Hi - I'm using the same php script and am having the exact same problem where the information comes to my inbox from "invalid_address@.syntax-error" and also none of the information that the user provided on the input form such as name and email address are in the body of the email that is sent to me. I'm sorry but I don't understand what NogDog is saying in his answer below?

    Many mail servers are configured to allow mail to only be sent with "From:" header which is a valid email address on that server. Therefore you may have to change your from address to your email address on that server, then add a "Reply-To:" header for the user's email address.
    I'm rather new at this. Can anyone explain this in terms I can understand?

    Thanks.

  5. #5
    Join Date
    Mar 2010
    Posts
    1
    bump

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,154
    Quote Originally Posted by stams View Post
    bump
    See my reply, above, and the tell me what part(s) of it you do not understand.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  7. #7
    Join Date
    Jan 2011
    Posts
    3

    Hi NogDog

    Hi, I'm getting the same error with a script am using. here's the threat:

    http://www.webdeveloper.com/forum/sh...d.php?t=241344

    However, when a forgotten password is requested, an e-mail is sent and the only error appears in the "From" field

    "INVALID_ADDRESS@.SYNTAX-ERROR." <INVALID_ADDRESS@.SYNTAX-ERROR.>

    I have failed to figure out where the problem could be. Looking at your post, I wonder what the e-mail address should be (Do i get this from my host?..am totally puzzled) and how to fix the "Reply to" variable. To make matters worse, other pages like newsletter subscription, confirm registration are working fine, it's only the forgot password that gives this error. please, help!! Thank you in advance.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles