SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I want to use {username} in a textarea when sending out an e-mail, how?

    Hello.

    I have a text area that when i click on submit it will send it via e-mail.
    However, i want to add the option to use {date} and that it will print the current date or {username} to get the username or {optout} to give them an unsubscribe link.

    How do i do that?
    I have searched the forums but couldn't find anything related.

    Thank you!

  2. #2
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    str_replace() ?

    Swift Mailer has a plugin for this sort of thing:

    http://www.swiftmailer.org/wikidocs/...gins/decorator

  3. #3
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    regular expressions looks like the right tool for the job

    PHP Code:
    $tpl 'hi {user}, you just won {sum}';

    $user 'joe';
    $sum '$100';

    $text preg_replace('/{(.*?)}/e''$$1'$tpl);

    echo 
    $text


Bookmarks

Posting Permissions

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