Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Changing Admin Email

Author  Topic 

jprauch
Starting Member

2 Posts

Posted - 2012-05-09 : 17:07:54
Hi, I just created a SQL database and I have it setup to email the admin whenever there is a submission. Currently, when the admin gets an email it is from the database username (user@quattro.websitewelcome.com). Is there a way I can change this to something else? I would prefer it be something like 'submission@mydomainname.com'.

Thanks so mcuh

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-05-09 : 18:18:20
Depends where you are initiating the email from. Are you using Database Mail? Or some other email component?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jprauch
Starting Member

2 Posts

Posted - 2012-05-09 : 19:26:24
Not familiar with Database mail...Here's how im doing it:

//echo $query;
//print_r($rows);
$post = "";
foreach ($_POST as $k => $v) {
if (is_numeric($k)) {
foreach ($rows as $row) {
if ($row['qid'] == $k) {
$post .= "\r\n\r\n " . $row['qt'];
break;
}
}
} else if ($k == 'office') {

} else {
$post .= "\r\n\r\n $k => $v ";
}
}
$query = "SELECT a.`email` AS email
FROM `offices` AS o
JOIN agents_offices AS ao ON ao.office = o.id
JOIN agents AS a ON a.id = ao.agent
WHERE o.id='$office'";
$result = mysql_query($query) or die("Error getting office email: ". $query);
while($row = mysql_fetch_assoc($result)) {
$email = $row['email'];
mail ($email , "CAREER INQUIRY" , "A new form submission has occured with the following data: " . $post);
}

echo "Your information has been successfully submitted. A CAREER ADVISOR will contact you soon. Thanks.";
?>
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-05-10 : 18:31:27
As this isn't SQL Server code, you'll need to post your question on a site that deals with the technology you are using. Looks like you are using MySql. SQLTeam.com is for Microsoft SQL Server. It makes a big differences when it comes to this type of code...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -