|
Hello
I have partly followed this tutorial:
Sending email with an embedded image through ASP.NET[^]
and, though the user receives his email, when I test my SMTP locally, the plain background image (600px x 600px) does not appear. In Visual Studio (2013), I don't get any errors. The image, emailBG.jpg, is in my Images folder in Solution Explorer, and the code I am using to send plain and HTML emails, and for the background image, is as follows:
Dim PlainMessage As AlternateView = AlternateView.CreateAlternateViewFromString("Hello. To reset your password....Nothing, "text/plain")
Dim mimeType As ContentType = New ContentType("text/html")
Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<p style......Nothing, "text/html")
Dim Logo As New LinkedResource(Server.MapPath("~/Images/emailBG.jpg"), "image/jpeg") 'embedded image
Logo.ContentId = "emailBG"
myMessage.AlternateViews.Add(PlainMessage)
myMessage.AlternateViews.Add(HtmlMessage)</<pre lang="HTML"> pre>
Thanks for any advice.
|
|
|
|
|
Please post your question in the forum at the end of the article, so the author sees it.
|
|
|
|
|
Hello Richard
Thanks for your reply.
The article is 10 years old - not sure if the author will even see it.
Thanks again.
|
|
|
|
|
Looks like the HTML version of your message has been truncated, so we can't see what styles you've applied.
And remember, if you're setting a background image for a <p> tag, it will be cropped to the site of that paragraph of text. You probably want to specify the <body> tag, and put the background image there:
Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<body style=""background:url('cid:emailBG') no-repeat;"">...</body>", Nothing, "text/html")
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, you're right. I do have that against 'p' at the moment:
("<p style='font-family, etc.....'>Hello " & strEmailValue & "<br /><br /> To reset your password....etc</p>", Nothing, "text/html")
I will take on board what you suggest about 'body' as opposed to 'p' and use your 'cid:email.BG'.
Would I still need these two lines that follow the above line I have posted above:
Dim Logo As New LinkedResource(Server.MapPath("~/Images/emailBG.jpg"), "image/jpeg")
Logo.ContentId = "emailBG"
Isn't 'Logo.ContentId = "emailBG"' a repetition of your 'cid:emailBG'?
Thanks.
Can you see this message though it is not in 'Preview'?
|
|
|
|
|
Yes, you'd still need the linked resource.
The cid: is the protocol which lets the mail client know that the image should be loaded from the linked resources in the message, rather than trying to load it from a file or a website.
So cid:emailBG in the HTML is a URL that points to the embedded resource with the content ID set to emailBG .
How do I embed images in an email?[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks.
I am familiar with that link - been hours on this!
I will give it all a go and fingers crossed!
Many thanks again for your help.
|
|
|
|
|
Hi,I want to use Skype for develop virtual classroom i.e. Online classroom In The Asp.net web application project with C#.So that when the time comes classes start Skype for all student in this class.
I will be grateful to you if you provide any solution.
Thanks in Advance
modified 25-Feb-17 4:05am.
|
|
|
|
|
|
Hi,
I have developed audio recording facility to my website.. But it is giving wav formatted base64string.. Can we convert wav to mp3 format or if possible can we reduce base64String size? Because internet explorer is supporting only mp3 files to play.. Is there any way to solve my issue?
Any suggestion will be useful for me.. Thanks in advance..
|
|
|
|
|
|
Hi Richard,
Thanks for your valuable reply and solution link.. I will go through on it once..
Is there any way to reduce size of the base64String..I am uploading mp3 file as base64String..It is taking too much time to upload.. I would be very grateful for any feedback you could might be able to give me.
|
|
|
|
|
Not that I've seen.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Respected Sir,
I saw your code regarding "A New Task Scheduler Class Library for .NET"
My question is, I want to create task on XP and later, Server 2000 and later
with BootTrigger,LogonTrigger,DailyTrigger,TimeTrigger triggers.
I am not able to create it on windows 10 using above code.
Will you please suggest me required dll or required changes?
Regards
|
|
|
|
|
Member 10579375 wrote: I saw your code ... Then please post your question in the forum below the code.
|
|
|
|
|
i searched google a lot still got no good explanation with example. mostly all write up is saying put is idempotent and post is not but i need a sample code which discuss or show idempotency of put method. so my request anyone can explain the put idempotency with example code or redirect me to right article link which discuss the same with example code. thanks
tbhattacharjee
|
|
|
|
|
|
I want to redirect to Home.aspx page but I am getting this error message:"System.Web.HttpException: Response is not available in this context" in the line of Response.Redirect("Home.aspx"); Any idea on solving this?
if ((strbuffer[11].ToString() == strCard1[11]))
{
UserID = "0000";
Send_Beep();
System.Diagnostics.Debug.WriteLine(("UserId: " + UserID));
comRFID.Close();
Response.Redirect("Home.aspx");
}
else
{
Response.Write("<script>alert('Card Undefined, Please Register Your Card.');</script>");
}
modified 20-Feb-17 8:58am.
|
|
|
|
|
We need to see the context. Where is this code being called from?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, this is my aspx.cs file:
private void comRFID_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
System.Diagnostics.Debug.WriteLine("comRFID_DataReceived");
comRFID.Read(hex, 0, hex.Length);
//Send_Beep();
System.Diagnostics.Debug.WriteLine("hex[0].ToString()");
System.Diagnostics.Debug.WriteLine("hex[1].ToString()");
System.Diagnostics.Debug.WriteLine("hex[2].ToString()");
System.Diagnostics.Debug.WriteLine("hex[3].ToString()");
System.Diagnostics.Debug.WriteLine("hex[4].ToString()");
System.Diagnostics.Debug.WriteLine("hex[5].ToString()");
System.Diagnostics.Debug.WriteLine("hex[6].ToString()");
System.Diagnostics.Debug.WriteLine("hex[7].ToString()");
System.Diagnostics.Debug.WriteLine("hex[8].ToString()");
System.Diagnostics.Debug.WriteLine("hex[9].ToString()");
System.Diagnostics.Debug.WriteLine("hex[10].ToString()");
System.Diagnostics.Debug.WriteLine("hex[11].ToString()");
string[] strCard1 = { "2", "12", "18", "128", "4", "0", "149", "124", "243", "50", "224", "243" };
//byte[] bytes = { hex[0], hex[1], hex[2], hex[3], hex[4], hex[5], hex[6], hex[7], hex[8], hex[9], hex[10], hex[11] };
string[] strbuffer = { hex[0].ToString(), hex[1].ToString(), hex[2].ToString(), hex[3].ToString(), hex[4].ToString(), hex[5].ToString(), hex[6].ToString(), hex[7].ToString(), hex[8].ToString(), hex[9].ToString(), hex[10].ToString(), hex[11].ToString() };
if ((strbuffer[11].ToString() == strCard1[11]))
{
UserID = "0000";
Send_Beep();
System.Diagnostics.Debug.WriteLine(("UserId: " + UserID));
comRFID.Close();
Response.Redirect("Home.aspx");
//Server.Execute("Home.aspx");
//HttpContext.Current.Response.Redirect("Home.aspx");
//Server.Transfer("Home.aspx", true);
}
else
{
Response.Write("alert('Card Undefined, Please Register Your Card.');");
Send_cmd();
}
modified 20-Feb-17 22:40pm.
|
|
|
|
|
So based on the name, that method is being called when data has been received from a serial port on the server - potentially some time after the page has finished executing and returned the response to the user.
The user is not still connected to the page, and there is no "response" to alter.
You need to read up on how ASP.NET works:
Understanding ASP.NET Application and Page Life Cycle - A Beginner's Tutorial[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello,
I'm building a web application which involves using Google Translation.
The goal is to have the user enter the text into a text-box on my form, and then my code should take that string and enter it into Google Translate and retrieve translation. Any ideas how I can do that? Google Translator doesn't affect URL in any way when a query is entered or when a result is returned. It's completely in-page and URL independent, so I can't do anything there.
Any ideas?? I'm using VB.NEt
Thanks
|
|
|
|
|
Most likely you need to use an API or service provided by Google. Go to the Google developers website and see what features are available.
|
|
|
|
|
|
how could I scroll image for vb 2010?
|
|
|
|