Jump to:

23371 Posts in 18161 Topics by 2865 members

General Questions

SilverStripe Forums » General Questions » Emailing image $Avatar

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 511 Views
  • borriej
    Avatar
    Community Member
    267 Posts

    Emailing image $Avatar Link to this post

    Hello,

    I have memberprofiles in place with a registerform on the front-end. People can register and they get added to the Member table. I also have forum module installed, and therefor Member table is extended with a Avatar. People can upload an Avatar in the registration form. This all works, and you can view the avatar in your online profile or in the CMS (as admin).

    After registration a few emails get send: 1 to Admin, 1 to user.

    Ok now my issue:
    in the emails i would like to include the avatar.. but how?

    ive tried lots of things, like

    <% control AvatarID %>
    <img src="$SetWidth(150).Link" />
    <% end_control %>
    <% control Avatar %>
    <img src="$SetWidth(150).Link" />
    <% end_control %>
    $AvatarID.SetWidth(150)
    $Avatar.SetWidth(150)
    $avatar.SetWidth(150)

          <img class="userAvatar" src="$FormattedAvatar" alt="Avatar" /><br />

    but they all result in a broken path/link for the image source..

    How do i include the avatar in the data that gets send?

    my email function:

       function onBeforeWrite() {

    if (!$this->owner->exists()) {

             /* ADMIN EMAIL ACTIVATE */
             $AdminEmail = new Email();
             $AdminData = $this->owner->getAllFields();
             $AdminToAddress = Email::getAdminEmail();
             $AdminEmail->setTo($AdminToAddress);
             $AdminEmail->setSubject('Nieuw lid: Activatie vereist');
             $AdminEmail->setFrom($this->owner->Email);
             $AdminEmail->setTemplate('EmailAccountActivation');
             $AdminEmail->populateTemplate($AdminData);
             $AdminEmail->send();
             
             /* USER EMAIL CONFIRMED CREATED */
             $UserEmail = new Email();
             $UserData = $this->owner->getAllFields();
             $UserEmail->setTo($this->owner->Email);
             $UserFromAddress = Email::getAdminEmail();
             $UserEmail->setSubject('Uw account is aangemaakt');
             $UserEmail->setFrom($UserFromAddress);
             $UserEmail->setTemplate('EmailAccountCreated');
             $UserEmail->populateTemplate($UserData);
             $UserEmail->send();
          
          
    }
    }

    511 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.