Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2017, 03:37 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 295
Default JEDI TJclEmail component assign a name to attachment

Does anyone know how to assign a name to the email attachment using the TJclEmail component.
I inherited a dll that uses the component and now i am have to add a naming option for the attachment.
adding the attachment is pretty straight forward
jclemail.attachments.add(_afilename);
but how do i give it a new name to display. like 'Annual Sales Report'?
Reply With Quote
  #2  
Old 02-17-2017, 04:18 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,185
Default

Just name the filename 'Annual Sales Report' (don't forget to add an extension)

Ask yourself this question, how would you do this mannualy in lets say outlook? It also has no rename the attachment option, it's always the filename.
Reply With Quote
  #3  
Old 02-17-2017, 06:23 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 295
Default Outlook ole

actually has the ability to give the attachment a name.
i had to write a dll that used smtp that had the same functionality of our mapi based dll. I figured out how to give the attachment a different display name and thought it would be a good feature to have. well now clients/users want the same ability from our jclemail mapi based dll.
i am just not sure where to look in the JEDI TJclEmail stuff to figure out how to give it a different display name.
Reply With Quote
  #4  
Old 02-20-2017, 08:15 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,185
Default

JEDI stuff is very old (and I don't like it)
But Delphi comes with Indy, why not use that?

http://stackoverflow.com/questions/3...agebuilderhtml

Or if you want to stick to the JEDI I would just rename the base-file (or add a copy in %tmp% and work with that untill you really send
Reply With Quote
  #5  
Old 02-20-2017, 03:00 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 295
Default

well that i would love to do but does Indy work with MAPI.
I already used the Indy components for the smtp.
Reply With Quote
  #6  
Old 02-21-2017, 08:10 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,185
Default

No, but I doubt that the MAPI supports this rename of attachment. I use Outlook 2007, I know it's older but this one also doesn't have a rename option. Therefor I found this a somewhat weird question.
But any question is valid, so also this one. I still guess they rename by just renaming the temporary attachment. Outlook for example places all attachments in a folder when composing the mail. But you cannot use this through MAPI because any other mail client can use it's own approach.
Only thing you can do is remove the attachment (not the original file), make a copy where you rename it, attach it again and remove the copy file.
Reply With Quote
  #7  
Old 02-21-2017, 02:51 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 295
Default well i am going to just move on from this issue

Background for the renaming of the attachment:
In our software we send out an email with the attachment with a specific extension. We add a registry entry to our clients so they can open the attachment and go to a specific section of our software and a specific record loaded.
we create a temporary file in the c:\tmp folder and attach it to the email. So rather than the recipient seeing a temporary file name that we generated they would see. 'Purchase Order 999999 Update' or 'Leave Request from xxxxxxxxxxx' stuff like that. but for now i will just leave the MAPI at the attachment name of a temporary file and add the extract info to the body.
Yes the body already has the info plus more, it was just a neat feature to use on our smtp sites.
Reply With Quote
  #8  
Old 02-22-2017, 08:59 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,185
Default

Instead of a temporary file name create a temporary (unique) folder for each mail. In there you don't have to use your temporary file names but you could use the correct names and then attach
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:40 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.