CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Email Notification upon registration

Print topic Send  topic

Author Message
jmccann

Posts: 10
Posted: 04/22/2008, 6:32 AM

I need to build a registration solution that registers new subscribers. Upon completion I want to send two emails.
1: To subscriber saying "Thank you etc with subscription details."
2. Confirmation to site owner of a new subscriber.

How do I do this with Codecharge?

Is there a sample?
View profile  Send private message
tonyk

Posts: 163
Posted: 04/24/2008, 3:38 PM

In the onvalidate event or before insert events I build a random 32 character string in a hidden field .Then after inserting the record in the after insert event for the form I retrieve the values I require to be able to send the email. i.e. $Container->formname->email->GetValue();

The previously built random string of 32 characters is appended to a link sent in the body of the welcome email. (the email is not sent if a previous applicant has used the same e-mail address (avoids irritating false applicant spam by proxy)). The random string has been stored in a field in the database.

the email might say
Dear Jon Bloggs,
welcome to mydomain.net, please click on the link below using the id and password you created during the application process.

http://www.mydomain.net/reg_confirm.php?regnum=123456789.....

Clicking on the link takes them to a page access to which is limited to registered users, they are diverted to the login page and after successful login the regnum field is read in the reg_confirm.php page in the before show event, the database is updated to show successful registration and the email showing the details is transmitted to the site owner. The random string is deleted from the database record. and the screen displays a thankyou response or a record not found response.

In php to send an email from a linux based machine is really easy.
This is a sample of php code that I know works.
$to_email=$Container->formname->email->GetValue();
$from_name="who its from";
$from_email="email address of sender";
$headers = "From: ".$from_name."<".$from_email.">;\r\n";
$headers .= "Content-Type: text/html";
$subject = "whatever you want as the subject";
$message= "whatever you want as the body";
//the next line sends the email
mail ($to_email,$subject,$message,$headers);

There are probably more elegant ways of doing this but I have two sites up and running that use this mechanism. Requiring verification significantly reduces spam as no-one gets bothered until after confirmation of the application, and if it is a spammer they only have one crack per email address.

Hope this helps,

Tony

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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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