I want to embed images saved in local directory into an outlook email. Have defined a function to do that and also added the html according. However, the image doesn't come up. Not an issue with the file path as I've already checked that it's working. What did I do wrong?
def Emailer(text, subject, recipient, cc):
import win32com.client as win32
import os
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.CC = cc
mail.Subject = subject
mail.HtmlBody = text
mail.Display(True)
MailSubject = "Daily Report for " + date_slash
MailInput ="""
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
"""
MailInput = MailInput.format(date_slash, sum_path, ovdv_path, cot_path, rub_path ,pnl_path)
MailRecipient ="xxx#yyy.com;"
MailCc = "xxx#yyy.com;"
A remote recipient cannot obviously see files from your machine.
You need to add images as attachments (Attachment = MailItem.Attachments.Add) and set the PR_ATTACH_CONTENT_ID MAPI property to the value used in the <img> tag (e.g., <img src='cid:MyTestId'>) using Attachment.PropertyAccessor.SetProperty:
Attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "MyTestId")
Related
sorry for this dummy question but i am having a trouble in my django and react app.
i have an endpoint which serves the image name but the image is saved in my local directory and in my react app i just want to append the file name like this
function Condition(props) {
let src = C:/Users/25191/Desktop/python_projects/doctorsolve/Drsove/media/media/images/HealthCondition/${props.meddata.image}
return (
<>
<div className="item">
<a href="#">
<img src={src} alt="medicine item image" />
<div className="desc">
<p className="medicinename">{props.meddata.title}</p>
</div>
</a>
</div>
</>
);
}
If the question is how to refer to a local file, then use the file URI:
file:///C:/Users/25191/Desktop/python_projects/doctorsolve/Drsove/media/media/images/HealthCondition/${props.meddata.image}
Try:
<img src="" alt="description">
I'm making a website and for some reason the images are not showing up on the browser. The ALT TEXT is appearing correctly but the images are not. Images have been placed in public/images...
The code is as:
<section03>
<div class="container-fluid">
<div class="row">
<div class="col-4">
<img src="public\images\untitled.png" alt="an image">
SOME TEXT
</div>
</div>
</div>
</section03>
try to use forward slash for image path instead of back slash
<section03>
<div class="container-fluid">
<div class="row">
<div class="col-4">
<img src="public/images/untitled.png" alt="an image">
SOME TEXT
</div>
</div>
</div>
</section03>
More examples: >>>
developer.mozilla.org/en-US/docs/Web/HTML/Element/img
w3schools.com/html/html_filepaths.asp
You need to set static folder path first for the express app in order to access static files using ejs or html. Here we will consider public folder as a static folder for our app.
Just copy the below line to the entrypoint of your app & then replace "./public" with your public folder path.
app.use(express.static("./public"));
Complete Example Code
const express = require("express");
const app = express();
app.use(express.static("./public"));
app.get("/", (req,res) => {
return res.send("welcome")
})
/* Start Server */
app.listen(5000, () => {
logger.info(`Success, service running on port 5000.`);
})
Also,
<img src="public\images\untitled.png" alt="an image"> will be replaced with <img src="/images/untitled.png" alt="an image">
UPDATE: I changed the image displaying on my page to an encoded version, instead of referencing the external image. I was able to put my image into a Base64 converter, and then copy and paste the string version of the image into the file (represented by ~~~ in my code below). This worked fine. Is there a similar method for encoding the icon?
Problem: I have a HTML Application file (.hta) that I've created. To make the user experience more customized I would like to change the icon for the taskbar (and maybe the actual file when looking at it in the file explorer or on SharePoint). The reason I want to encode the image instead of using a file is because when I try to use a network file, it takes a 'long' time to open the .hta file and I know this will annoy my end users. It is a basic site with links to open template files that we use frequently, the purpose is to open a copy of the most recent template so we make sure everyone is using the most current templates and knows where all of the tools we use are located. I've researched this quite a bit and I can't seem to find a solution that works for me.
What I've Tried:
I've tried the "trick" where I use the Command Prompt to copy the .ico file to the .hta file. This does change the icon but displays a bunch of nonsensical text at the top of my page above all of my content. If someone has a solution for removing this, that works. Unless this is not a stable solution...
I've also tried converting my image to Base64 and using that when declaring the ICON in < HTA:APPLICATION ... />, similar to encoding for < img >, but it didn't work for me. When I tried, nothing happened.
Additional Comments: I'm OK with any solution really, as long as the image is encoded and it is stable.
Basic Structure of Working File (UPDATED):
<!DOCTYPE html>
<html>
<HTA:APPLICATION ID = "oMyApp" APPLICATIONNAME = "MyApp" ICON = "path" BORDER = "thick" CAPTION = "yes" SHOWINTASKBAR = "yes" SINGLEINSTANCE = "yes" SYSMENU = "yes" WINDOWSTATE = "maximize" />
<head>
<title> My App </title>
<link rel = "icon" href = "path">
<link rel = "sytlesheet" type = "text/css" href = "StyleSheet.css">
</head>
<body> <div class = "content">
<div class = "Title">
<img src = "data:image/png;base64,~~~" alt = "icon" />
<strong> My App </strong>
</div>
<div class = "main">
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
</div>
<div class = "Footer">
<em> Comment to Users </em>
</div>
</div> </body>
</html>
Please Help
i am trying to scrape mailto (href) from a html file, but i am unable to "hit" it.
Any advice is welcome.
<div class="exhibitor-contact">
<div class="col">
<h3>
whatever </h3>
<p>
MLW <br /> whatever<br /> 75008 Paris - France </p>
<p>
<a class='inverse-a-span' href='#tel' id='tel' onclick="return xt_click(this,'C', xtn2, xtpage.replace(/\w*$/, 'exhibitor::tel').replace(/^Exhibitors::/, ''), 'A')">Show Phone Number</a><span style='display:none;'>whatever</span><br /> Send an Email<br /> </p>
</div>
</div>
</section>
Code:
Set my_data = IE.Document.getElementsByClassName("anyclass")
Set mail = IE.Document.getElementsByTagName("a")(0) ActiveSheet.Cells(i, 2).Value = mail.href
Use a css attribute = value selector with ^ starts with operator
Debug.Print ie.document.querySelector("[href^='mailto:']").href
Im trying to make a site compatible with IE8. It all looks good save one image not scaling. Any suggestions for a possible fix? Heres the appropriate code. The large picture is the one giving me issues
<div class = 'picture-container' id = 'pc1'>
<div class = 'large-picture' id = 'lp1'>
<figure style = 'float:left;max-width:45%;height:auto'>
<img src = 'make-up_artist_dupontstudios.png' width = '100%' height = '100%' class = 'no-mobile'>
<figcaption class = 'red-cap'>Our Set-Up</figcaption>
</figure>
<div class = 'picture-content'>
<div class = 'picture-title'>BOUTIQUE PRODUCTION STUDIO</div>
<div class = 'picture-text'>We built a boutique full service production studio that allows for
one, two and three person filmed interviews and conversations.
We have studio lights, a three camera set-up and remote
monitoring. Additionally, our Infinity Wall creates a clean and
professional look that allows the film to be about the message.</div>
<div class = 'small-picture'>
<img src = 'hair_and_makeup_dupontstudios.png' width = '175' height = '100'>
</div>
<div class = 'small-picture'>
<img src = 'infinity_wall_dupontstudios.png' width = '175' height = '100'>
</div>
</div>
</div>
</div>