Jean
|
Posted: 03/19/2004, 10:00 AM |
|
Hi,
I try to make a autorespond e-mail when you submit a form. It works, except that I do not see the content in my mail. This is what I have:
In Form Properties: Events: Custom Action:
(after: case "insert":)
//-------------------------------
$receiver= $_POST ['email']; // contains e-mail from form field
$subject = "thanks for your reaction!";
$headers = "MIME-Version 1.0\r\n";
$headers = "Return-Path:abc@nospam.fr \r\n";
$headers .= "From:abc@nospam.fr<abc@nospam.fr>\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-15\r\n";
$query = "SELECT Autorespondtekst FROM Autorespond";
$mailcontent = mysql_query($query);
// the above 2 lines are the problem, it works when replaced with this: $mailcontent = "<html><body>hey! this works! </body></html>";
mail($receiver,$subject,$mailcontent,$headers) or die("No mail send!");
Anyone a n idea?
|
|
|
sebastian
Posts: 15
|
Posted: 03/19/2004, 12:32 PM |
|
Try using:
$txt = mysql_fetch_assoc(mysql_query($query));
$mailcontent=$txt["Autorespondtekst"];
Sebastian
|
|
|
Jean
|
Posted: 03/20/2004, 8:58 AM |
|
Doesn't work: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in line ...
By the way, the column 'autorespondtekst' has one field containing a message in html.
Other suggestions?
|
|
|
peterr
Posts: 5971
|
Posted: 03/20/2004, 9:26 AM |
|
Maybe check the results of the query. See http://www.php.net/mysql_fetch_assoc for an example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
peterr
Posts: 5971
|
Posted: 03/20/2004, 9:31 AM |
|
BTW, here are others discussing the same topic: http://groups.google.com/groups?q=mysql_fetch_assoc+%22...ult+resource%22
There are 113 discussion threads, so possibly this could provide dome clues.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
Jean
|
Posted: 03/22/2004, 4:48 AM |
|
Ah, finally succeeded! For others to learn, this did it:
So how to send an automatic e-mail after submitting a form? The e-mail text comes from a databasetable called autorespond, with a column with one field called Autorespondtext. The bodytext (Autorespondtext) can be in html.
In the form:
Form Custom Action after case "insert":
//-------------------------------
$receiver= $_POST ['email'];
$subject= "Thank you for your reaction!";
$headers = "MIME-Version 1.0\r\n";
$headers = "Return-Path:abc@xyz.com\r\n";
$headers .= "From:abc@xyz.com<abc@xyz.com>\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-15\r\n";
$query = "SELECT Autorespondtext FROM autorespond";
$txt = mysql_fetch_assoc(mysql_query($query));
$mailcontent=$txt["Autorespondtext"];
mail($receiver,$subject,$mailcontent,$headers) or die("Something went wrong with sending an e-mail to you...");
Thanks for the help Peter and Sebastian!
|
|
|
|