Coder Social home page Coder Social logo

Problem embedding resource about mvcmailer HOT 6 CLOSED

smsohan avatar smsohan commented on August 13, 2024
Problem embedding resource

from mvcmailer.

Comments (6)

smsohan avatar smsohan commented on August 13, 2024

Use server.MapPath or something similar to map the path relative to your bin.


Sent from my iPhone
S M Sohan

On 2011-11-17, at 5:16 PM, jonchai
[email protected]
wrote:

Without embedding resource, it I can send out emails just fine. However, if I were to try the following:

PopulateBody(mailMessage, viewName: "ResetPassword", linkedResources: resources);

I get error Could not find a part of the path. I have set "/Content/images/logo.png" as my path but it points to 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\Content\images\logo.png' instead. Any idea how I could get this going?


Reply to this email directly or view it on GitHub:
#30

from mvcmailer.

jonchai avatar jonchai commented on August 13, 2024

I understand that Server.MapPath is the way to go. However, Server.MapPath is not directly accessible from the Mailer class. The only way I could think of doing is to pass the path from controller to the Mailer class' constructor, but this would definitely cause some mess.

Any other workaround?

from mvcmailer.

smsohan avatar smsohan commented on August 13, 2024

Mailer base is a controller base and has access to http context. You
can use that.


Sent from my iPhone
S M Sohan

On 2011-11-17, at 5:47 PM, jonchai
[email protected]
wrote:

I understand that Server.MapPath is the way to go. However, Server.MapPath is not directly accessible from the Mailer class. The only way I could think of doing is to pass the path from controller to the Mailer class' constructor, but this would definitely cause some mess.


Reply to this email directly or view it on GitHub:
#30 (comment)

from mvcmailer.

jonchai avatar jonchai commented on August 13, 2024

Ah, yes, I see. It works now. Sorry, didn't dig deep into your codes to find out. Thank you for your help.

from mvcmailer.

smsohan avatar smsohan commented on August 13, 2024

Happy to help:)


Sent from my iPhone
S M Sohan

On 2011-11-17, at 5:50 PM, jonchai
[email protected]
wrote:

Ah, yes, I see. It works now. Sorry, didn't dig deep into your codes to find out. Thank you for your help.


Reply to this email directly or view it on GitHub:
#30 (comment)

from mvcmailer.

jonchai avatar jonchai commented on August 13, 2024

:) Cheers.

For others who have trouble, just do base.CurrentHttpContext.Server.MapPath

from mvcmailer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.