Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get email subject from outlook using vfp

Status
Not open for further replies.

EddHizon

Programmer
Jul 28, 2017
6
BN
The email received have a link to click and would like to get the email subject when the link is clicked
 
There's no eligible reason to be able to do so even for the sender of the mail, MS would open up all doors to spyware even not needing any installation to start scanning users conversations from their outlook profile, if you could do that.

How long are you a programmer? In what fields did you do programming so far?

Perhaps watch this?
Bye, Olaf.
 
Hi Olaf,

I'm using VFP for quite some time now and been able to do some application for my work.

I've created an email to be sent from VFP with the link and would like to pickup the Subject once the recipient open the email and clicked the link.
 
The application is actually within the Company I am working only and not to anyone else.
 
If I am not mistaken, you asked the same question yesterday, and then deleted the whole thread? If that's correct, it's not the way to do it! Don't delete a thread!

Regarding your question, it's not possible, and for very good reasons. Instead you make the links unique by adding a key which you can then decipher on the receiving end.
 
EddHizon,

It would be helpful if you could explain exactly why you want to do this. The problem is that it could be seen as some sort of malware exploit, and while we want to help you with any legitimate problem, we have to be cautious. If you could give us a bit of background to the application, that would help. (You don't need to mention the name of the company or any other confidential information, of course.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Edit: I have rephrased and rewritten this to make more sense to you, perhaps...



If you generate the email on your own, you can embed any info you want into the URL of the link. Ever thought of that?

1. There is no need to have code within the email to be able to act on the click event of the link.
2. Code doing such a thing would be much more complex than simply putting the subject text into the URL, URL encoded, of course.
3. Any code, which could theoretically run within HTML in general, would be JS (Javascript), but Outlook - any mail client - won't execute that, Outlook is not a browser.

So:
1. There is a simpler solution
2. Even if there would be a complicated solution within a browser ...
3. ...it would be impossible to execute in a mail client, not only in Outlook.

Furthermore: Even if it would be possible to execute JS within an HTML mail, how would it access mail item fields? It would have access to the HTML the DOM of the email body text, but there would be no natural object name or reference to get at the mail item and its properties.

So there is nothing you can do within the email, everything has to be done when generating/sending the mail already and then can be processed as info coming in with the click of the link at the web server, so any info you want to transport has to be part of the link itself already.

Last, not least:

You might have seen some functionality like this in Outlook within your company, then ask the makers of what you saw. I guess they make use of Outlook Forms, which are based on Office Forms and work with code having access to the current mail item fields, as far as I googled. You need to have admin rights to a company repository of Outlook Forms and then can refer to them and send them to Company Recipients. It's a bit like a simple Intranet working on email basis. I never used them, but that's a whole world on its own besides text or HTML emails and to get to know this I recommend you look for an Outlook forum and ask about the capabilities of Outlook Forms.

Bye, Olaf.
 
>I've created an email to be sent from VFP with the link

Surely, if you are creating the email, then you already know the subject and can thus use it in the URL when constructing the URL, rather than trying to figure it out at the recipient's end (which is essentially what Olaf is saying in the post above)
 
To answer tbleken, I did not actually delete the thread, when I received an email as responded by Olaf I clicked the link and it was missing already. Then I posted the same question.

To answer Mike:

The application created is actually two types of module to run, one is the "Application" and the other one is "Approval". When the applicant sent the application, the approver received the email, once he clicked the link the system created will run "Approval" Module. Part of the subject will then be referred and will go directly to the application to be approved. This is to make the approver directly access the Approval of the applicant. If then the application is approved the email will be sent to the applicant with the link as when clicked (Application Module) he will see the status of the application

But if this method will create something that will jeopardize the company for some spams or virus I will have to remove this functionality.

Thanks Olaf and strongm for your suggestions will look into them.

 
>But if this method will create something that will jeopardize the company for some spams or virus I will have to remove this functionality.

You misunderstand. What you want to do is prevented and limited by mail clients, so such a jeopardy isn't possible - or in the lilght of no 100% security - not that simple.

But the solution is not to want the email to add the mail subject to the link as parameter, instead embed it while creating it. Is it really that hard to understand? Isn't it much simpler and straight forward? Why aim for a complicated solution, when there is a much simpler one not needing code executed by outlook only the functionality to execute a link as it does without any programming?

Any URL can have a portion after a question mark with parameters, and you can write that out at the time you generate the mail, when you also set the subject as the mails subject, you can put that same text as a paremeter into the link you generate in the mail body.

It seems you're not familiar with the possibilities of URLs and the way to receive parameters from a request server side. If the nature of the link is just a file link, then this would not be possible, but I also don't see how you could make a difference, if you were able to embed any functionality into a mail, that acts on events like the click on a link.

Let me assume your email link rather is the link to the approval.exe or a shortcut lnk file starting the approval.exe, then I don't see a href="some.lnk parametervalue1 paramtervalue2" working, as that isn't a legal URL. While generating the mail you could generate cmd/bat files, that have the correct approval.exe parameterization and then link to that individual cmd. But even that would be complicated, why not shre the info by sharing data? Both executables can work on the same DBC or DBFs or MySQL Database, if the approvers are external to the company. It would be much more natural to share data via the backend, wouldn't it?

Bye, Olaf.
 
EddHizon, your explanation is helpful. As Olaf mentioned, the issue was not that this was a threat to your company or could produce spam. Rather, what we saw was someone coming to the forum for the first time, and asking how to do something that a spammer might typically want to to know. That's why we were cautious.

To answer your original question, you are presumably using some process on the server side to serve as the target of the link. This would need to be written in a server-side language such as PHP. All such languages can receive parameters from a URL, and that is how you should pass the subject of the email.

As a rough guide, your code would look something like this:

Code:
* VFP code to generate the email

* assume loMail is your message object
WITH loMail
  .Subject = "[b]XYZ[/b]"   && where XYX is the unique subject that you with to trap
  .HTMLBody = [<p>Please click this link: <a href="[b][URL unfurl="true"]http://myserver.com/myscript.php?subject=XYZ[/URL][/b]">Click here</a></p>]
  .To = ""           && fill in the To, CC, etc. as appropriate
  .Send
ENDWITH

PHP:
// Server-side code to trap the subject line
// Assumes PHP, but other languages would be similar
$my_subject = $_GET['subject'];

// The variable $my_subject now contains the desired subject

Note that the above is not meant to be working code. It's just an example to give you the general idea.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Olaf and Mike. Well understood now and will apply as suggested.
 
The current top question is really about the type of link you put into your mail, if it's a link to a website or intranet or if it's rather a link to a shortcut or batch or command file. The first one can be parameterized easily, as Mike illustrated just now, the latter can't be, as that would require spaces in URLs to separate parameters from the file name of the exe/lnk/bat/cmd file. But then the problem can be deferred to put the parameterization within a cmd file, even if that means it's just working for a single call, you can create as many cmd files as you send out mails, as long as linking to them works for the recipient.

Overall what you do rather asks to be done as an intranet, internet or a cloud solution, not a VFP desktop solution.

And as I already said two desktop exes should rather mainly share data via a backend, not via mails. I understand the concept of informaing approvers, but wouldn't it be much simpler, if the approval application would just offer a list of applicants for approval at startup? Then all the mail would need to be is a reminder for the approver, that there are applicants waiting for approval of their application, the link within the mail would just be a static link to the lnk shortcut or a start cmd file or whatever you choose for that, there even wouldn't need to be a link, if the approver knows what and how to start it from the start menu.

Bye, Olaf.



 
>When the applicant sent the application, the approver received the email, once he clicked the link the system created will run "Approval" Module.

So you have a workflow ...

Which suggests another approach - you can do this within an organisation that is using Exchange and Outlook with (custom) Outlook Forms
 
A workflow also suggests using SharePoint:
That includes email as the communication tool, too - just to state users could adapt to the new workflow quite easily without changing habits. Same with Outlook Forms, obviously.

Both Outlook Forms and SharePoint Workflows need a server, though, I don't know how small your company is, there would be a reason you implemented the workflow with a set of VFP applications and not with Exchange or SharePoint Server as backend, you may not have any of these.

Bye, Olaf.
 
Thank you all once again and will try all the suggested options and use the best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top