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

 I'm stuck - send to e-mailaddress in form field

Print topic Send  topic

Author Message
Markie


Posts: 251
Posted: 08/13/2008, 12:25 AM

I want to build a grid with a simple mailform, just two fields ($subject and $recipient). Furthermore the grid contains a hidden field with an url to a photo ($photo). I would like the visitor to enter a message in the $subject field and the e-mailadress of the recipient in the $recipient field. After submitting the form I want the e-mail to go to the recipient.

I'm stuck. All I can achieve is that I can send an e-mail to the mailbox of my own server and not to the recipient. I have taken a look to a lot of other topics in this forum(s) but I haven't found the solution yet. I have also tried to work with phpmailer etc. and I can build a beautiful tellafriend solution, but it seems I can't send the url to the photo when working with a tellafriend page.

By the way, I have taken a look at the tellafriend example at http://www.gotocode.com/apps.asp?app_id=14& but ASP is really not my cup of tea. Is there an example for PHP and MySQL ?

Please can anybody help me out with building a simple mail form which sends the information to the recipient instead of the mailbox of my server ?

Markie
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
Markie


Posts: 251
Posted: 08/13/2008, 3:07 AM

I have solved my problem in the previous posting, what I did was:

I have made a plain record form (in my test situation I did not connect it to any database yet)
I did add the necessary form fields ($recipient, $subject, $photo)
I did add this code to the ADD button OnClick event:

Send Email
From: ="my-email-address@my-website.com"
To: Recipient
Subject: ="Download my photo"

(maybe this is not such a good title for a mail and it will be catched by spamfilters, but in my test situation it'll do)

HTML: False
SMTP server: localhost

It works great with my colocated server, but not with my local one (Xampp). Can anybody can help me out with the phpmailer class ??
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
datadoit
Posted: 08/13/2008, 6:37 AM

There's probably absolutely nothing wrong with your script. You're
likely dealing with other mail issues such as sendmail/SMTP, etc.

In your PHP.ini configuration, there are mail settings there. Start by
seeing what those are. If you're running on Windows, there is another
can of worms you have to open.

You mention that it works on your production server at your host
provider, but not your local XAMMP. Reason being is that your host
already has your environment set up to send via sendmail or SMTP. But
on your local XAMMP, unless you have Windows sendmail or IIS/SMTP, your
mail won't go out to the world.

Finally, if you're using PHPMailer, it has the ability to send via an
external SMTP host, and with authentification if necessary. I would
recommend updating your script to test whether you're on local Windows
or remote *nix, and adjust your mail script accordingly.
jjrjr1


Posts: 942
Posted: 08/13/2008, 7:12 AM

Hi

What can I do to help?

What have you tried in php mailer?

Let me know

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
Markie


Posts: 251
Posted: 08/13/2008, 8:34 AM

Thanks for your replies. I think I have found the right solution.

PLEASE CORRECT ME IF I'M WRONG! (sorry, didn't mean to shout :-)

First of all, I have downloaded the phpmailer classes and put them to C:\xampp\php\PEAR

Furtermore, I have made a new page with a record form and several form fields. I have add this custom code to the ADD button (server) OnClick Event:

//Custom Code @7-2A29BDB7
// -------------------------
require("class.phpmailer.php");

$mail = new PHPMailer();
$var1 = $phpmailer->foto->GetValue();
$var2 = $phpmailer->recipient->GetValue();
$var3 = $phpmailer->name_recipient->GetValue();
$var4 = $phpmailer->name_sender->GetValue();
$var5 = $phpmailer->message->GetValue();

$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "my-email-address@gmail.com";
$mail->Password = "mypasswd";

$mail->From = "my-email-address@gmail.com";
$mail->FromName = "$var4";
$mail->AddAddress("$var2", "$var3");
$mail->AddReplyTo("my-email-address@gmail.com", "$var4");

$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML

$mail->Subject = "download photo";
$mail->Body = "Click this link to download the photo<br>http://s3.mywebsite.com/originals/$var1<br><br>$var5";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Your message has been sent. You can now send the same photo to another recipient";
// -------------------------
//End Custom Code
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
jjrjr1


Posts: 942
Posted: 08/13/2008, 8:48 AM

There You Go.

That is exactly what you need to do.

Have fun.

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
Markie


Posts: 251
Posted: 08/13/2008, 11:15 AM

Thanks John, let's smoke a good cigar together some time ;-)

Markie
_________________
The Netherlands, GMT+1
Tools: CCS 5.1, Windows 7, Navicat, Ultraedit
Local server: XAMPP with Apache, php and MySQL
Webserver: Windows 2008 IIS 7, php and MySQL
View profile  Send private message
jjrjr1


Posts: 942
Posted: 08/13/2008, 7:42 PM

Sounds Good to me...
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
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.