robert4442 Posted July 27, 2007 Share Posted July 27, 2007 I have a host company that uses a top level domain and then virtual host (or domains) under that top level domain. I have set up a database floridafamilyorg on florida-family.org. When I use the php mail instruction the email uses the form business-net.com which is my top level domain. When the email is sent, it shows the sender domain part of the email to be my top level domain. Is there a way that the email shows it is from florida-family.org instead. Here is an example. If you go to http://florida-family.org/send_email_5.php and fill out the form, the recipient will get an email from the database email addresses that says they are from firstname.lastname@business-net.com. I would like it to say, firstname.lastname@florida-family.org instead. How can I do that? My Host says this is something you would have to setup within php to set the from address. Below is the script. <?php /*******************************************************************************\ ** ** ** This code has been generated with easyGen 2.4 ** ** http://www.easygen.com ** ** ** ** easyGen copyright © 2003 - 2007 Symbiant Software. ** ** Symbiant is a trading name of Credit Card Merchant Services Ltd. ** ** ** ** ** ** THIS CODE IS PROVIDED BY THE COPYRIGHT HOLDERS AND ** ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ** ** INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ** ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ** ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ** ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ** ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ** ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ** ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ** ** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS CODE, ** ** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** ** ** \*******************************************************************************/ // Turn on magic quotes to prevent SQL injection attacks if(!get_magic_quotes_gpc()) set_magic_quotes_runtime(1); // Connect to database $eg_objConn1 = mysql_connect("localhost", "root", ""); mysql_select_db("floridafamilyorg", $eg_objConn1); // Get Record Set $eg_recResult1 = mysql_query("SELECT `ffa_content`.`email_subject`, `ffa_content`.`email_content`, `ffa_content`.`page_content` FROM `ffa_content` ", $eg_objConn1); $eg_Result1 = @mysql_fetch_array($eg_recResult1, MYSQL_ASSOC); // Conditional statement if(!empty($_POST)) { // Get Record Set $eg_recResult2 = mysql_query("SELECT `send_emails`.`email_address`, `send_emails`.`title`, `send_emails`.`name` FROM `send_emails` ", $eg_objConn1); $eg_Result2 = @mysql_fetch_array($eg_recResult2, MYSQL_ASSOC); // Check that there are records in the recordset if(@mysql_num_rows($eg_recResult2) > 0) { // Set record set pointer to the start of the record set and begin looping mysql_data_seek($eg_recResult2, 0); while($eg_Result2 = mysql_fetch_array($eg_recResult2, MYSQL_ASSOC)) { $eg_text_1 = "Dear {TITL} {NAM},\n\n{BOD}\n\nSincerely,\n{SENDE}\n{EMAI}\n{ADDRES}\n\n"; $eg_text_1 = str_replace("{TITL}", @$eg_Result2['title'], $eg_text_1); $eg_text_1 = str_replace("{NAM}", @$eg_Result2['name'], $eg_text_1); $eg_text_1 = str_replace("{BOD}", @$eg_Result1['email_content'], $eg_text_1); $eg_text_1 = str_replace("{SENDE}", @$_POST['sender_name'], $eg_text_1); $eg_text_1 = str_replace("{EMAI}", @$_POST['senders_email'], $eg_text_1); $eg_text_1 = str_replace("{ADDRES}", @$_POST['senders_address'], $eg_text_1); } mysql_data_seek($eg_recResult2, 0); $eg_Result2 = mysql_fetch_array($eg_recResult2, MYSQL_ASSOC); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- This page has been generated with easyGen. (http://www.easygen.com) easyGen © 2003 - 2007 Symbiant. --> <html> <head> <title>Untitled</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table cellspacing="0" cols="1" cellpadding="0" width="100%" border="1"> <tbody> <tr> <td> <p> <table cellspacing="0" cols="1" cellpadding="0" width="100%" border="1"> <tbody> <tr> <td> </td> </tr> <tr> <td> <span id="label1"><?php echo @$eg_Result1['page_content'] ?></span> </td> </tr> <tr> <td> <form id="Form1" style="WIDTH: 100%" action="<?php echo $_SERVER['PHP_SELF'].(@($_SERVER['QUERY_STRING'] > ' ') ? '?'.$_SERVER['QUERY_STRING'] : '') ?>" method="post"> <p> <table cellspacing="0" cols="2" cellpadding="0" width="100%" border="1"> <tbody> <tr> <td style="WIDTH: 127px"> Your Full Name</td> <td style="WIDTH: 862px"> <input id="Text1" style="WIDTH: 858px; HEIGHT: 22px" size="117" name="sender_name"></td> </tr> <tr> <td> Your Email Address</td> <td> <input id="Text2" style="WIDTH: 858px; HEIGHT: 22px" size="117" name="senders_email"></td> </tr> <tr> <td> Your Address</td> <td> <input id="Text3" style="WIDTH: 858px; HEIGHT: 22px" size="117" name="senders_address"></td> </tr> <tr> <td style="HEIGHT: 21px"> Email Subject</td> <td> <input id="Text4" style="WIDTH: 858px; HEIGHT: 22px" size="117" value="<?php echo @$eg_Result1['email_subject'] ?>" name="email_subject"></td> </tr> <tr> <td style="HEIGHT: 21px" colspan="2"> <textarea id="TextArea1" style="WIDTH: 989px; HEIGHT: 36px" name="email_content" rows="9" cols="108"><?php echo @$eg_Result1['email_content'] ?></textarea> </td> </tr> <tr> <td colspan="2"> <input id="Submit1" type="submit" value="Submit Email(s)" name="Submit1"></td> </tr> </tbody> </table> </p> <p> </p> </form> </td> </tr> </tbody> </table> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </td> </tr> </tbody> </table> </body> </html> <?php // Tidy up used objects // Close recordset if(isset($eg_recResult1)) @mysql_free_result($eg_recResult1); // Close database connection if(isset($eg_objConn1)) @mysql_close($eg_objConn1); // Close recordset if(isset($eg_recResult2)) @mysql_free_result($eg_recResult2); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.