Jump to content

Using External SMTP Server with PHP Mail


trex2002ro

Recommended Posts

I need some help with an script

 


// send message
if($_POST[submit]) {

// check for suspected injection strings
foreach($_POST as $name => $value) {
	filter_string($value);
}

// check for unexpected newline characters
foreach($_POST as $name => $value) {
	if($name != 'message') filter_string($value);
}

$_POST = safe_data($_POST, 'display');

// check for required information
if(!$_POST[name])
	$error .= 'The <strong>Name</strong> field was left blank.<br/>';
if(!check_email($_POST[email]))
	$error .= 'The <strong>Email Address</strong> you entered appears to be invalid.<br/>';
if(!$_POST[subject])
	$error .= 'The <strong>Subject</strong> field was left blank.<br/>';
if(!$_POST[message])
	$error .= 'The <strong>Message</strong> field was left blank.<br/>';

// send message if no errors have occurred
if(!$error) {

	$message = "Sent: ".date($conf[dformat].' '.$conf[tformat], time()+(3600*$conf[toffset]))."

Name: $_POST[name]
Email: $_POST[email]
Phone: $_POST[phone]
Best time to reach me: $_POST[contact]

$_POST[message]";

	// remove any punctuation from name to prevent email errors
	$_POST[name] = ereg_replace("[[:punct:]]", " ", $_POST[name]);

	mail($sendto, $_POST[subject], $message, "From:$_POST[name] <$_POST[email]>");

	$sent = true;


 

I need to send the message using external SMTP.

I don't have acces to php.ini or web server's settings

 

Thanks

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.