Jump to content

Archived

This topic is now archived and is closed to further replies.

leeroy78

php mail through user

Recommended Posts

Hi,

We're having a problem with our php form sending to yahoo, aol, etc. The script is below. I believe it's using the standard SMTP of the server. I'd like it to use a username and password to authenticate through one of my accounts in mailenable and use that SMTP. Thanks.

<?php

// send to variables
//---- START EDIT HERE ------

$sendTo = $_POST["email"];
$subject = "Question";

/// ---- STOP EDIT HERE ------

// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = "From: " . $_POST["name"] ." ". "<" . $_POST["email"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own. The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$body = "Full Name: " . $_POST["name"] ."\r\n". "Email: " . $_POST["email1"] ."\r\n\r\n". "--------Ask The Doctor--------" . "\r\n" . "Message: " . $_POST["message"];

// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $body, $headers);

?>

Share this post


Link to post
Share on other sites
This is not a service.

If you would like help learning how to do something using php, then please ask.

Share this post


Link to post
Share on other sites
[!--quoteo(post=354742:date=Mar 13 2006, 08:48 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 13 2006, 08:48 PM) [snapback]354742[/snapback][/div][div class=\'quotemain\'][!--quotec--]
This is not a service.

If you would like help learning how to do something using php, then please ask.
[/quote]

I thought I was asking

Share this post


Link to post
Share on other sites

×

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.