Page 1 of 1
Sending email upon registration
Posted: Thu Nov 25, 2004 3:06 am
by angelena
I would like to include an auto email function upon each successful registration which include the username n password.
Would like to know how should i start with this.
Thanks
Posted: Thu Nov 25, 2004 3:17 am
by phpScott
for sending email checkout php's [php_man]mail[/php_man]() function.
otherwise it is select the infor you want to send from the db, create the body of the text, the send it.
the mail() has pretty decent examples for basic emails then you should be able to go from there.
Posted: Thu Nov 25, 2004 3:39 am
by angelena
Code: Select all
mail ($to, $subject, $content, $headers, "myemail@myhost.com");
okie...so i think this the format rite?
One more thing im not too sure bout is where shud i include this function?My page function as after click the submit button where the code is as following :
Code: Select all
<?PHP if($veri=="false"){ ?>
<input type="submit" name="submit" value="View First">
<?PHP } else { ?>
<input type="submit" name="submit" value="Submit">
<?PHP } ?>
<input name="RESET" type="RESET" value="Clear"></td>
</tr>
and after click submit it will redirect back to this page to run the following part code :
Code: Select all
<?PHP require('includes/headbanner.php'); ?>
<div class="mlm" align="center"><?PHP echo("Member "); echo($country_code); echo($nric); echo(" had been registered successfully.<br>"); ?></div>
<div class="mlm" align="center"><?PHP echo("<a target=_blank href=invoice.php?membercode=$country_code$nric&invoiceid=$invoice_id>View invoice</a>"); ?></div>
<?PHP require('includes/bottombanner.php'); ?>
<?PHP } ?>
emm..i not too sure which part of the code to insert the mail function.
Posted: Thu Nov 25, 2004 3:44 am
by phpScott
you should include the mail function after you have successfully entered the data into the db, otherwise it doesn't really matter where you put it but probably on the same page that inserts the data.
Posted: Thu Nov 25, 2004 3:52 am
by angelena
Code: Select all
Member MY112233 had been registered successfully.
Mail sent to uremail@hotmail.com
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\domain\gv\mlm\sign_up_03.php on line 704
I inserted the mail function n get this error message,is it the version of php im using not compatible or the config prob?
Posted: Thu Nov 25, 2004 4:11 am
by phpScott
in your php.ini file you should be able to change your SMTP variable to your SMPT server address or name.
If you have an email client then just find it out from there.
save your php.ini file, restart your server then you should be good to go.
Posted: Thu Nov 25, 2004 4:17 am
by angelena
i did try to find out bout the SMTP thg,i dun haf any email client,and this email function im using in my own localhost server,does that means i will need to set SMTP=localhost ?Is it compulsory to set the sendmail_from and how would i know which is my sendmail_path?
Thx for helping

Posted: Thu Nov 25, 2004 4:18 am
by angelena
i did try to find out bout the SMTP thg,i dun haf any email client,and this email function im using in my own localhost server,does that means i will need to set SMTP=localhost ?Is it compulsory to set the sendmail_from and how would i know which is my sendmail_path?
Thx for helping

Posted: Thu Nov 25, 2004 4:34 am
by phpScott
if your using windows don't worry about the sendmail_path;
if you don't have an email account that you can pilfer the SMTP server from you will have to find and download one from the web to run on your local machine.
the from can be set in either your mail() or you can set it in your php.ini file as a default if you want.
Posted: Thu Nov 25, 2004 10:18 pm
by angelena
i check with the person-in-charge of the server n i was told that there's no SMTP in the server im using,im using Windows..is there any other alternative for me to still able send email from my php?
Sorry for being so blank with all this.
Posted: Thu Nov 25, 2004 10:28 pm
by josh
A solution, register at my website
http://pythonweb.com/jshpro2
and then go to
http://pythonweb.com/jshpro2/services/
Activate the email service
It will get the job done because I allow you to specify a URL to foward to after sending the email so your users would not notice they even left your site!
it is made for processing form mail but you could just as easily send a header("location:script?data=stuff&etc........");
Theres example usage when you sign up on my site.
An alternative would be to manually connect to some one else's SMTP server, like connect to hotmails SMTP server and send mails useing that I guess.
Posted: Fri Nov 26, 2004 3:09 am
by angelena
i dun really get the idea of this url parsing,could u pls elaborate it for me?thn will it affect my page?
Posted: Fri Nov 26, 2004 10:18 am
by josh
Basically you would send the header location to
http://mysite.com/something/script.php? ... ge=message here
Then my script sends the email to
someone@hotmail.com then fowards you back to your website.. try it out then youll understand