CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Printing values in a email

Print topic Send  topic

Author Message
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>");
}
View profile  Send private message
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.... :)
View profile  Send private message
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!
View profile  Send private message
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
View profile  Send private message
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.... :)
View profile  Send private message
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?
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.