ASP.NET 2 - how can I embed variables in an email body text file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark1249

    #1

    ASP.NET 2 - how can I embed variables in an email body text file

    Hello,

    I am using ASP.NET 2 and using the CreateUserWizar d I am wanting an
    email to go out to the new user informing them of their account details
    etc...

    I have a BodyFileName in the MailDefinition section of the
    CreateUserWizar d component and have that currently pointing to a simple
    text file where I want to embed the account detail variables and email
    text.

    I have read on a website that you can use embedded variables, such as
    <% UserName %> which obviously displays the username and which I have
    had working, but I can't find anything anywhere else that tells me what
    the other default available variables are or ideally, how I can define
    and add my own.

    There are ways around this by dynamically creating the email text in
    code, but I would really like to use the embeded variables as I think
    this will be easier in the long run.

    Any help would be much appreciated.

    Many thanks in advance.

    Cheers
    Mark...

  • clintonG

    #2
    Re: ASP.NET 2 - how can I embed variables in an email body text file

    I've built a mail merge in ASP and its not too difficult.
    These <% ... %> are called "Code Blocks" or "Render Blocks" [1,2]

    <%= Clinton Gallagher
    NET csgallagher AT metromilwaukee. com
    URL http://clintongallagher.metromilwaukee.com/

    [1]

    [2] http://msdn2.microsoft.com/en-US/library/ms178135.aspx


    "Mark1249" <mark@email2han d.com> wrote in message
    news:1142983363 .151622.188640@ i40g2000cwc.goo glegroups.com.. .[color=blue]
    > Hello,
    >
    > I am using ASP.NET 2 and using the CreateUserWizar d I am wanting an
    > email to go out to the new user informing them of their account details
    > etc...
    >
    > I have a BodyFileName in the MailDefinition section of the
    > CreateUserWizar d component and have that currently pointing to a simple
    > text file where I want to embed the account detail variables and email
    > text.
    >
    > I have read on a website that you can use embedded variables, such as
    > <% UserName %> which obviously displays the username and which I have
    > had working, but I can't find anything anywhere else that tells me what
    > the other default available variables are or ideally, how I can define
    > and add my own.
    >
    > There are ways around this by dynamically creating the email text in
    > code, but I would really like to use the embeded variables as I think
    > this will be easier in the long run.
    >
    > Any help would be much appreciated.
    >
    > Many thanks in advance.
    >
    > Cheers
    > Mark...
    >[/color]


    Comment

    • Mark1249

      #3
      Re: ASP.NET 2 - how can I embed variables in an email body text file

      Hi Clinton,

      Thank you very much for your response.

      The thing I was talking about in my original email were not code render
      blocks (unless I am wong, which could be very likely), they are
      actually tags that insert data into the email text (very similar to a
      Word Mail Merge etc...).

      In asp.net 2 I have created a site with Forms authentication which
      includes profiles for capturing First Name and Last Name etc.., and
      want to customise the standard emails that you can set to be sent once
      a new user registers or resets their password etc... and I read
      somwhere that you can customise this email text, however with something
      like the password recovery email it needs to be able to send the user
      their new password along with the customised text. I have managed to
      do this using the tag "<% Password %>" and in the new user email I can
      send the new user a reminder of what their password is by including the
      tag "<% Username %>". Manybe these are considered code blocks, but my
      understanding is that code blocks are for use in HTML and start with
      "<%=" rather than "<%" rather than for use in a text file for the
      purpose of customising the emails.

      My question is that I am wondering what other "<% xxxx %>" tags are
      available and also how I can use these tags to put in some of my
      profile data such as First Name and Last Name?

      Any help would be much apreciated as I could write a customised email
      compiler, but I really want to use as much of the in-built asp.net
      tools as I can.

      Looking forward to your response.

      Regards
      Mark...

      Comment

      Working...