asp.net mvc 4 - Including logo when sending email via postal -
in mvc4 application, using postal package sending emails.
i trying include logo via <img>
tag, it's not working.
how can include company logo?
controller action:
public actionresult index() { dynamic email = new email("example"); email.to = "xxxxx@xxxxxx"; email.funnylink = "haiii"; email.send(); return view(); }
view:
to: @viewbag.to from: lolcats@website.com subject: important message <div style="background-color:aqua;"> hello, wanted important web links right? check out this: @viewbag.funnylink <br /> <img src="~/images/logo.png" /> </div>
you need use full absolute image urls this-
<img src="@request.url.getleftpart(uripartial.authority)/images/logo.png" />
or
if you're having html based files should send domain name other data you're passing view this-
<img src="@viewbag.domainname/images/logo.png" />
when email received users content of email not resolve image path relative urls -
/images/logo.png {this not work}
so images can fetched if having full domain path.