Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: CFMAIL Help

  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CFMAIL Help

    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.
    Last edited by 3510; 05-07-2003 at 11:38 PM.

  • #2
    New to the CF scene
    Join Date
    Dec 2002
    Location
    Peterborough ON Canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    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.
    * Why do people say w w w dot... Why not just say triple-w dot (A Pet Peeve) *


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •