?
Solved

Sending email from Dreamweaver Insert Record behavior

Posted on 2009-04-08
3
Medium Priority
?
673 Views
Last Modified: 2013-12-13
Is it difficult to set up and use PHP Mail to send an email when a user updates a record in the Database?
0
Comment
Question by:axessJosh
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 24102121
Hi axessJosh,

No.

From the previous question, the insert action happens here:

  $Result1 = mysql_query($insertSQL, $connYOURDB) or die(mysql_error());

  $insertGoTo = "somepage.php";

So you just need to add mail() code in between those lines:

  $Result1 = mysql_query($insertSQL, $connYOURDB) or die(mysql_error());
   
$Name = "Sender";
$email = "email@adress.com";
$recipient = "otheremail@otheremailadress.com";
$mail_body = "Hi";
$subject = "Something"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n";

mail($recipient, $subject, $mail_body, $header);

  $insertGoTo = "somepage.php";
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24102132
However, be aware that this will cause the Insert behavior to disappear (or show a red !) in the Behaviors panel.  The code will work, but the extra code breaks DW's syntax check for behaviors.
0
 
LVL 17

Expert Comment

by:houssam_ballout
ID: 24102291
after the update statement, simply use the mail function as jason use in his first post
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question