Jump to content

SENDING EMAIL PLEASE HELP


kdawg2k12

Recommended Posts

this is my email.php file

 

 

 

<?php

 

 

 

 

$senderName  =$_POST['userName'];

$senderEmail  =$_POST['userEmail.'];

$senderMessage =$_POST['userMessage.'];

 

 

//security

$senderName=stripslashes($userName);

$senderEmail=stripslashes($userEmail);

$senderMsg=stripslashes($userMessage);

 

 

 

 

$to      = 'myName@mydomain.com';

$from    = 'myName@mydomain.com';

$subject = 'Testing CONTACT PAGE';

 

 

$message = 'Message From your site:

 

 

Their Name: $senderName

 

 

Their Email: $senderEmail

 

 

Their Message is below:

 

 

$senderMsg';

 

 

// Build $headers Variable

 

 

$headers = 'From: Company <mysite@mydomain.com.com>' . "\r\n";

 

 

$to = '$to';

    // Send the email

    mail($to, $subject, $message, $headers);

 

 

$my_msg='thanks your message has been sent.';

 

 

print $my_msg;           

?>

 

 

 

 

The error I'm getting is  this:

 

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\PHP_Test\email.php on line 5

 

all I want to be able to do is verify my form works and that I can  receive emails from users of mysite any help would be greatly appreciated. Also what should the send_mail in  the PHP.INI file be set to?

 

thansk

Link to comment
Share on other sites

$senderName   =$_POST['userName'];
$senderEmail  =$_POST['userEmail.']; // should the full stop be here?
$senderMessage =$_POST['userMessage.']; // should the full stop be here?

//security
$senderName=stripslashes($userName);
$senderEmail=stripslashes($userEmail);
$senderMsg=stripslashes($userMessage); 

 

$senderName   =$_POST['userName'];
$senderEmail  =$_POST['userEmail.']; // should the full stop be here?
$senderMessage =$_POST['userMessage.']; // should the full stop be here?

//security
$senderName=stripslashes($senderName);
$senderEmail=stripslashes($senderEmail);
$senderMsg=stripslashes($senderMessage);

 

Also, you should wrap code in


or


tags

Link to comment
Share on other sites

Pikachu2000  yes that is the full script

 

I have a html form that retrieves the information. Can someone give me an example of what I need to change in the PHP.INI file to test it locally? and What I should have in the email.php file when i upload it to the live server?

 

I been racking my brain tryna figure this stuff out for over a week now!

Link to comment
Share on other sites

Although the full stops probably aren't supposed to be in the code above, with associative indices, they work fine. With enumerated indices, the index value is truncated at the full stop, but no parse errors are thrown.

 

$array[1.1] = 'numeric';
$array[1.2] = 'numeric2';
$array['string.string'] = 'associative';
$array['string.string2'] = 'associative2';
echo '<pre>';
print_r($array);
echo '</pre>';

// RETURNS: Array
(
    [1] => numeric2
    [string.string] => associative
    [string.string2] => associative2
)

Link to comment
Share on other sites

$_POST['userMessage.'] the period shouldn't be there, they're not allowed in array keys. This is the issue.

 

Array keys are just strings. You can put pretty much whatever you like in there.

 

$a = array('^$r%9)k!!~`}+0h*' => 'foo');

 

is perfectly valid.

Link to comment
Share on other sites

okay i resolved the last error and now I am getting this error

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_

 

I would like to  use a secure connection  and use port 465 but I do not know all the parameters i need to configure to do this please advise and thanks for the help guys I am a newbe to PHP

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.