...

View Full Version : CFMAIL Help



3510
05-08-2003, 12:33 AM
Not to sure with cfm how to send an email just after a new insert to a sql server database, I am helping a friend out. Anyway if someone could help that would be great, here is the code::

<cfquery datasource="sqlusers">
SET IDENTITY_INSERT NewMembers ON
INSERT INTO NetUsers (userid, Address , FirstName , Gender , JoinDate , LastName , Password , PostCode , State , Suburb , UserName )
VALUES (#NewUser#, '#form.Address#' , '#form.FirstName#', '#form.Gender#', '#dateformat(form.JoinDate,"yyyy-mm-dd")#', '#form.LastName#', '#form.Password#', '#form.PostCode#', '#form.State#', '#form.Suburb#', '#form.UserName#' )
SET IDENTITY_INSERT NewMembers OFF
</cfquery>

Need email to be sent to an admin here.

<edit> Forgot to mention that in the email I need there username & password in the email too </edit>

Thank you.

OFAH
05-08-2003, 10:23 PM
Put the CFMail tag either before or after the insert statement (i would recommend after the insert)

( I am hoping this works with SQL Server (I use Access myself) )

------------------------------------------------------------------

<cfmail to="admin@email.com" from="valid_address@email.com" subject="Custom Subject here" server="192.168.1.1" port="25">

Customized message here with the form fields added.

Name: #form.FirstName#
Address: #form.Address#

Username: #form.UserName#
Password: #form.Password#

etc, etc....

</cfmail>



LEGEND:

TO: Enter the administrator's e-mail address here.

FROM: Enter a valid e-mail address (one that is registered on the mail server (i.e. the Admin's e-mail address))

SUBJECT: Anything you want

SERVER: IP Address of the mail server (SMTP)

PORT: Port that the mail server is accepting mail on, default is 25

( For HTML / Rich Text e-mails, add tag [ type="HTML" ] to the CFMAIL tag )


Hope that this helps.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum