Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    Join Date
    Feb 2014
    Posts
    277
    Actually I had already tried to downgrade BuzzMMO projects from 4.6. to 4.52 and it really didn't work. What I mean is that VS2015 totally spat the dummy and wouldn't work at all nor could I even create a new project!

    I've been using .net 4.5.2 for my latest tests.

    Hmm....... you really shouldn't be able to run Scaffolding.core 1.0 in either VS2013 or VS2015.
    Opening up the PMC gives an error every time unless I am running the latest scaffolding built for VS2015.
    You can't have 2 different scaffolding loaded at once either.
    No clue why you are so lucky!

    see:
    http://stackoverflow.com/questions/1...ualstudio-2013
    scroll to the bottom.
    also see:
    https://github.com/smsohan/MvcMailer...-by-Step-Guide
    for why he had to modify it to work with VS2013 a year ago.

    Still, I'm the one with the problem, not you

    **Edit - same problems with a BuzzMMO.Web project set to .net 4.5.1 even one created from scratch.

    Conclusion MVCMailer 4.5.0 or 4.5.1-pre will not work with any available T4Scaffolding.Core v1.0 or 1.03.
    If it does work, which I have seen briefly, it causes problems down the track.
    Opening the Package Manager Console will also give errors if T4Scaffolding is incompatible. Then errors appear in the VS Activity log as well as VS being unable to even open a .cshtml file until VS is restarted.

    Ignoring scaffolding completely will sent an e-mail if you create the ~/Mailers/UsersMailer.cs and the ~/Views/UsersMailer/VerifyEmail.cshtml files manually, but VS2015 becomes unstable and just gives errors sometimes for no reason.
    I am giving up on MVCMailer in VS2015 until I see something appear to fix it.
    Last edited by oldngrey; 10-12-2015 at 08:17 PM.

  2. #12
    Join Date
    Dec 2009
    Location
    Atlantis
    Posts
    167
    I'm off work over the next week and will upgrade to vs 2015 i'll check in with how it goes
    Last edited by GreyWalker; 10-13-2015 at 07:54 PM.

  3. #13
    Join Date
    Feb 2014
    Posts
    277
    As mentioned I gave up on MvcMailer. I then tried Postal.Mvc5.
    Why? I just wanted a nice system that was a lot like mvcmailer.

    Short story is that it works. It doesn't have Scaffold support so you have to do a lot of it yourself.
    Features:
    * can be written to be very similar to MvcMailer
    * uses almost the same Web.config settings as MvcMailer
    * produces the same e-mail and verify link as Nelson's video.

    OK..... here's the long answer.
    1. Do the "User Registration" video up until the 40:22 mark then just watch it for information. Don't do anything!
    2. When you are ready to proceed use Nuget to install Postal.Mvc5

    3. Open RegisterController.cs and find the commented out line that sends the email - line 48 or thereabouts. Here's the command to send the email:
    Code:
    new UsersMailer().VerifyEmail(user);
    4. Make sure the using statements at the top has:
    Code:
    using BuzzMMO.Web.Mailers;
    5. Create a folder in the top of the project called Mailers
    6. Create a class called UsersMailer.cs. In this bit we only do the verifyemail method. You will have to add the ResetPassword method in that video. It should be easy but I haven't done it yet.

    Code:
    using BuzzMMO.Data.Entities;
    using Postal;
    
    namespace BuzzMMO.Web.Mailers
    {
        public class UsersMailer
        {
            public void VerifyEmail(User user)
            {
                dynamic email = new Email("VerifyEmail");
     
                email.To = user.Email;
                email.Subject = "Please verify your email address to activate your BuzzMMO account";
                email.From = "xxxxxx@gmail.com";     // valid from address
    
                email.Token = user.VerifyEmailToken;
                email.Username = user.Username;
    
                email.Send();
            }
        }
    }
    7. Ensure there is a folder called Emails under the Views folder.
    8. Inside the Emails folder, create a Razor MVC view file called VerifyEmail.cshml
    Code:
    Content-Type: text/html; charset=utf-8
    @using Postal
    
    <html>
        <h1>Welcome @ViewBag.Username</h1>
    
        @{
            var tokenUrl = Url.Action("verify", "register", new {token = ViewBag.Token}, Request.Url.Scheme);
        }
    
        <body>
            <p>
                Please
                <a href="@tokenUrl"> click here </a>
                to verify your account.
            </p>
    
            <p>
                Or copy and past the following link in your browser:
                @tokenUrl
            </p>
        </body>    
    </html>
    9. Finally edit the web.config file somewhat like Nelson's at the 58:26 mark. Here's mine with my username and password obviously not done.

    Code:
     <system.net>
        <mailSettings>
          <smtp deliveryMethod="network">
            <network enableSsl="true" host="smtp.gmail.com" port="587" userName="some-email@gmail.com" password="valid-password" />
          </smtp>
        </mailSettings>
      </system.net>
    10. Then you can register a user as per the video after the 59:04 mark, click the link in the e-mail and be registered.

    I hope this helps someone.
    Last edited by oldngrey; 10-13-2015 at 02:05 AM.

  4. #14
    Join Date
    Jun 2008
    Location
    Iran / Tehran
    Posts
    285
    @oldngray it certainly helped me thanks for the help
    If you want to learn something, start teaching about it to others, nothing will help you more than that !

Page 2 of 2 FirstFirst 12

Posting Permissions

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