Send Email Using Classic ASP with an Embeded Image - image

i am making NewsLetter using the wysiwyg Editor.. it allows me to upload the Image Path
and Image Path is stored in the Upload Directory..
Not When i retrieve that Image using it works in website..
the editor's value is stored in database
example
<br> hi
<img src="upload/acb.gif">
<br>
Hello
i am sending Email and the detail of this email is received from database
and this detail is sent to visitor
he is gettion all text value but not able to see Image
so suggest me what to do..?

If you are sending emails using CDOSYS.Message, you can easily send a complete web page with embedded images using the Message.CreateMHTMLBody(url) method.
Dim Message
Set Message = CreateObject("CDOSYS.Message")
Message.From = "from#email.org"
Message.To = "to#email.org"
Message.CreateMTHMLBody "http://yourserver.org/email.html"
Message.Send()

I recently cleaned up some code I had lying around to do this and slapped it online as a "Gist" on github; hope it still helps someone!
Sending embedded images with CDOSYS
This solution uses CDO (CDOSYS / CDO.Message), with "AddAttachment", and manually controlling the properties of the attachments to make them usable from within the email HTML and to avoid them appearing as separately-downloadable attachments in an email client.
The usage is very simple, just reference the images by a local path (on the computer the code is running on) in the HTML of the message, eg:
Some Image: <img src="<EMBEDDEDIMAGE:C:\test.jpeg>" />
The code will pick up the filename, add the file as an attachment to the message, and replace the relevant part of the message HTML with the internal reference to that attachment.

You would have to add site url to img source
<img src="http://www.sitename.com/upload/acb.gif"> as the user is not accessing your site from his mailbox.
For this you can set "http://www.sitename.com/" as a key in web.config and use in your mails.
This will resolve your problem for sure. Happy coding !!!!!!!!!!!!!

You would use AddRelatedBodyPart:
Embed Usage
Create Array and Pass it in "SendMail" Function as Parameter
Use in Email Body e.g.
Dim arrRelatedBodyPart(1)
arrRelatedBodyPart(0) = Server.MapPath(".") & "/images/barcode/bar_blk.gif"
arrRelatedBodyPart(1) = Server.MapPath(".") & "/images/barcode/bar_wht.gif"
Example
For i = 0 To UBound(arrRelatedBodyPart)
Dim strPathAndFileName: strPathAndFileName = arrRelatedBodyPart(i)
Dim strFileName: strFileName = GetFileName(arrRelatedBodyPart(i), "/")
'.AddRelatedBodyPart strPathAndFileName, strFileName, cdoRefTypeId
Set objCDOBodyPart = .AddRelatedBodyPart(strPathAndFileName, strFileName, 1)
objCDOBodyPart.Fields.Item("urn:schemas:mailheader:Content-ID") = "<" & strFileName & ">"
objCDOBodyPart.Fields.Update
Next

What are you using to send the email, I have had success in the past using AspEmail: http://www.aspemail.com/
It explains how to send embedded images here: http://www.aspemail.com/manual_04.html
However you will have to get it installed on your server, if you are using Shared hosting this might be a problem, if you are running your own server pretty easy!

Related

Send an image from smart device to the server in Genexus

I know there is already a similar question but the answers to that didn't work for me
I'm working with Genexus 16U11 and I have a panel with an image variable (called &sourceImage) with control type as "SD Image Annotation". I need to send this image to the server, in a specific folder. According the documentation if I call a procedure using the image as variable this should go on the server but it's not working. I can't find the image anywhere, I searched also in the PublicTempStorage directory, in the procedure is as the variable is empty.
I tried also to convert the image in base64 to send it as longvarchar to the procedure
&blob = &sourceImage.GetAnnotatedImage()
&longvarchar = ToBase64(&blob)
but in this way I can only get this string ZmlsZTovLy8vc3RvcmFnZS9lbXVsYXRlZC8wL0FuZHJvaWQvZGF0YS9jb20uYXJ0ZWNoLnJpY2hpZXN0YXBlcm1lc3NpMTZ1MTEuc2Zpcm1hL2ZpbGVzL3RyYW5zZm9ybWF0aW9ucy8yMDIyLTAzLTE4LS0xNC00My0yNi02MTQ2NDcyMTA5MjM5NDU3NzgzODAxLnBuZw==
that is the path of the file
file:////storage/emulated/0/Android/data/com.artech.richiestapermessi16u11.sfirma/files/transformations/2022-03-18--14-43-26-6146472109239457783801.png
I tried with file variable, blob, image, extra images, method fromUrl, nothing is working.
What am I doing wrong?
To upload the image to the server you need to call the procedure in the server (Connectivity=Online).
Then the image variable will be send to the server and you can save, copy, etc. there.
For example, save in a Transaction with a code like this:
Call in the panel:
Composite
&resultImage = &ImageA.GetAnnotatedImage()
procSaveImage(&resultImage)
EndComposite
Procedure online:
&TrnData = new()
&TrnData.TrnDataImage = &parmImage
&TrnData.Insert()
if &TrnData.Success()
commit
Working in Genexus v17u8 .

Attempting to read and download Outlook emails in jupyter notebook using win32

Two-fold issue: 1) Trying to download attachments from Outlook emails using win32 in Jupyter Notebook 2) I get notifications of different lessons and resources by phone. Then I usually, send the URL to the resource to my email to organize later on. Is there a way to use Jupyter Notebook to grab these emails and store them in an excel file? Here is the lesson I am trying to follow currently: https://towardsdatascience.com/automatic-download-email-attachment-with-python-4aa59bc66c25 . And here is my code:
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.items
message = message.GetFirst()
attachments = message.Attachments
attachment = attachments.Item(1)
attachment_name = str(attachment).lower() attachment.SaveAsFile(path + '\\' + atttachment_name)
exit
You never check that a message has attachments (message.Attachments.Count > 0) and you assume that you get a particular message from the Inbox: can either get the currently selected message (Application.ActiveExplorer.Selection collection) or you need to search for the particular message using Items.Find/FindNext or Items.Restrict. Items.GetLast will give some undetermined item.
Thirdly, the line message = message.GetFirst() was probably meant to be message = messages.GetFirst(). Still won't work, but at least it won't blow up because message variable is uninitialized.

Add hyperlinked image to email signature using vbscript, using str string

I realize this has been answered numerous times in the past, but I'm just having an issue with the final step of my hyperlinked icon in an email signature
I am adding my image and hyperlinking using the code below which works great, but I need to substitute the actual URL with an attribute from AD. I currently use strLinkedin = objUser.homePhone (I use home.Phone which is where I put the user's personal linkedin URL) and this works fine when I want to use strLinked, but I cannot seem to use it in the code below as the URL.
CODE - for images with a fixed URL (this works fine):
set objShape = objSelection.InlineShapes.AddPicture("\\path\share\4.png")
objSelection.Hyperlinks.Add objShape, "https://twitter.com/example";
Need to have it similar to (this doesn't work obviously, it just makes the link the show strLinkedIn):
set objShape = objSelection.InlineShapes.AddPicture(" \\path\share\4.png")
objSelection.Hyperlinks.Add objShape, "strLinkedIn"
Using the code just above, the output shows the text strLinkedin rather than the result of strLinkedin = objUser.homePhone.
If someone could please possibly help me with the final 'tweak' that would really be appreciated.
Fixed, code is:
strLinkedin = objUser.homePhone
set objShape = objSelection.InlineShapes.AddPicture("\path\share\4.png")
objSelection.Hyperlinks.Add objShape, strLinkedIn
Simply, no "".

Flex 4 coltware airxmail - send vCal appointment

I am using coltware.airxmail to send emails from my Flex app.
I would like to send VCalendar appointment files generated from Flex straight to Outlook so they are opened in the Calender view. I am able to send the VCal files as an attachment on an email, however, these are not "auto-opened" in Outlook Calendar, which requires the user to double click on the file.
I have been trying to set the content type of the mail to "text/x-vCalendar", and pass in a byte array containing the VCal file, however, no joy. The vCal arrives as a .txt attachment to an empty email!
I wonder if anyone has had previous experience with this kit, or can suggest any pointers?
Or even suggest another component they have used to send VCal files straight to outlook, from ActionScript?
Here's my sample code (DEMO CODE VERY MESSY JUST TO GET POINT ACROSS):
var sender:SMTPSender = new SMTPSender();
// Set the from / to / host / port values here
var contentType:ContentType = new ContentType();
contentType.setMainType("text/x-vCalendar");
var message:MimeMessage = new MimeMessage(contentType,"UTF-8");
var file:File = File.desktopDirectory.resolvePath("vcal.vcs");
file.addEventListener(Event.COMPLETE,
function(ev:Event):void {
message.addRawContent(file.data);
sender.send(message);
sender.close();
});
file.load();
Hopefully I can achieve this using the coltware component. There's nothing on their site about using these methods, although the API guide is very incomplete - just "basic usage"... http://code.google.com/p/airxmail/wiki/HowToUseAPI
Did you try using a different content type, such as "text/calendar"? see here: http://weblogs.asp.net/bradvincent/archive/2008/01/16/creating-vcalendars-programmatically.aspx

ms access linked image relitive path

I have an Image object.
I have the Picture type set to linked, so I can change the picture if I want.
I have the Picture property set to the picture name.
I would think that access would use relitive addressing and simple looking in the current directory for the image. But it does not and I get an error telling me it cannot find the picture.
Anyone have a solution? (Other than setting the Picture type to embedded or using the full file address?)
Thanks!
Update:
Tried this:
Private Sub Form_Load()
Dim file As String
file = CurrentDb().Name
file = Replace(file, ".mdb", ".bmp")
Me.Image46.Picture = file
End Sub
It works, except I still get the error message. I click O.K. and it works. Just need the error message to go away.
SOLUTION: Use the above code (or the code posted in the answer below) and then set the 'picture type' to "embedded" and then delete the 'picture' field so that it says "(none)".
Save and run.
It should work.
THANKS!
You could set the property on the forms OnLoad event like this
Me.imgMy_image.picture=getDBPath & “mypicture.bmp”
Here is the getDBPath function
Public Function GetDBPath() As String
Dim strFullPath As String
Dim I As Integer
strFullPath = CurrentDb().Name
For I = Len(strFullPath) To 1 Step -1
If Mid(strFullPath, I, 1) = "\" Then
GetDBPath = Left(strFullPath, I)
Exit For
End If
Next
End Function
Before anyone comments yes I know in access 2000 and above you can use currentproject.path but I’m stuck in the land that time forgot so need that custom function, it still works with later versions of access
Current folder depends of the way you open database in Access. At least, if you open it thru "File-Open", current folder changes to the folder of MDB file. But if you open via double-clicking MDB in explorer, it does not.

Resources