INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to get email subject from outlook using vfp

How to get email subject from outlook using vfp

(OP)
The email received have a link to click and would like to get the email subject when the link is clicked

RE: How to get email subject from outlook using vfp

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? https://www.ted.com/talks/james_veitch_this_is_wha...

Bye, Olaf.

RE: How to get email subject from outlook using vfp

(OP)
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.

RE: How to get email subject from outlook using vfp

(OP)
The application is actually within the Company I am working only and not to anyone else.

RE: How to get email subject from outlook using vfp

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.

RE: How to get email subject from outlook using vfp

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

RE: How to get email subject from outlook using vfp

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.

RE: How to get email subject from outlook using vfp

>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)

RE: How to get email subject from outlook using vfp

(OP)
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.

RE: How to get email subject from outlook using vfp

>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.

RE: How to get email subject from outlook using vfp

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

* VFP code to generate the email

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

CODE --> 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

RE: How to get email subject from outlook using vfp

(OP)
Thanks Olaf and Mike. Well understood now and will apply as suggested.

RE: How to get email subject from outlook using vfp

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.



RE: How to get email subject from outlook using vfp

>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

RE: How to get email subject from outlook using vfp

A workflow also suggests using SharePoint: https://support.office.com/en-us/article/Introduct...

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.

RE: How to get email subject from outlook using vfp

Yep, SharePoint would be the next level.

RE: How to get email subject from outlook using vfp

(OP)
Thank you all once again and will try all the suggested options and use the best.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close