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.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -