testalex
Posts: 4
|
| Posted: 08/17/2009, 3:25 AM |
|
Hey all!
This is probably a simple question but I would to print 1 or 2 fields in an email
eg one of the fields is called "from" I would like to print this in the message body.
How would i go about doing that? Could someone please help me out, I'm stuck.
This is what I got at the moment:
$to = "blal@blah.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
|
 |
 |
damian
Posts: 838
|
| Posted: 08/17/2009, 3:58 AM |
|
try this link: http://forums.codecharge.com/posts.php?post_id=74388&s_keyword=implode
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
testalex
Posts: 4
|
| Posted: 08/17/2009, 5:46 AM |
|
Hey!
Thank you very much for your reply I really appreciate it,
however, that post is very confusing. I'm sure which part of code im meant to be looking at.
Im sorry to be a pain, but do you happen to have any suggestions or any other links.
Thanks again!
|
 |
 |
GeorgeS
Posts: 206
|
| Posted: 08/17/2009, 11:08 AM |
|
I'm not sure if this is what you are looking for but this is how I'd use a variable inside $body string:
$from = "Testalex";
$body = "Hi,\n this is a message from $from \nHow are you?";
_________________
GeorgeS |
 |
 |
damian
Posts: 838
|
| Posted: 08/17/2009, 7:14 PM |
|
i create a page with ccs with as much info including database info and images etc as I want and then i implode it in my email function. i use ccs events to trigger the email and the actual email is html formatted....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
testalex
Posts: 4
|
| Posted: 08/18/2009, 2:43 AM |
|
Hey all,
Thank you all for your replies i really appreciate it.
I found some solutions although i cant seem to get the primarykey printed.. is that possible?
im using this:
$to = $Component->bookshop->GetText();
$subject = "BookOrder ".$Component->orderid->GetText()."";
$body = "Hi ".$Component->book1_quant->GetText().",\n\nHow are you?";
$headers = "From:sender@example.com\r\n" .
"X-Mailer: php";
if (mail($to, $subject, $body, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
in this case mine is orderid.
At the moment i get an error saying
Fatal error: Call to a member function GetText() on a non-object in .... @ line 21 which is:
$subject = "BookOrder ".$Component->orderid->GetText()."";
Can anyone help?
|
 |
 |
|