Submitting data through email using asp.net - c#

I am creating a application that will send emails to users requesting some information to be filled.
The user must be able to fill the informations requested.
What should be the right approach to achieve this ,
A html form should do this or a link should be given to every different user

Email has no interactive capabilities, so you can't embed a form in the email message like you would in a webpage.
A decent solution is to embed a link in the email which takes the user to a page on your app where they can fill in a form and submit the answer to you, like with any webform.
Since you have an email for each user, you could generate the link as myapp.com/responses/${some_part_dependent_on_email}. Where the ${some_part_dependent_on_email} can be a hash of the email or some bijective function of the email. The first option requires that you do a more complex join to find out to which email a response belongs to, whereas the second one might expose users emails in the URLs, which is not so great.

Related

c# : Approve / Reject through eMail : Not Buttons : Minimal Clicks

I have developed an application, which has got an approval flow. The application approval / reject is working fine and I have been tasked with developing a solution for approval through emails, instead of the users log in on to the application, which anyway uses domain credentials. The application is hosted locally, allowed locally only, and is not published onto any public IPs. This requirement of mail approvals are for Management approvals, who are on the move most of the time and will not be agreeing to go for a VPN Access of the said application.
So far I developed a solution which sends an eMail to the approval authority with 2 URLs (one for approve and other for reject). When the recipient of the mail clicks on the relevant link the action is updated in the database. Until here everything was tested and working fine.
Now in case the mail is forwarded by the authorized approver to a different email ID, they secondary recipient also will be able to click on the relevant links and get the database updated which is not the intended functionality since the secondary recipient is not an authorized approver.
Any suggestions on how to control this are desired.
Edit 1
To the 2 URLs I am sending in mail, I am adding a query string, which is a unique identifier associated with the approval authority ID.
However, if the same mail is forwarded to a secondary recipient, I am not sure on how to validate the eMail ID from which the click originated.
Edit 2
I have tried the suggestions (given in the comments below ). I have generated the mail with Request ID in the subject of the mail and requested the users to reply to that mail with only one word in body either Approve / Reject. I have ensured that the application shall process it in a case insensitive way. However, there were so many typos for one word that I could not imagine the number of combinations I had to cope up with.
I have also tried, having the Request ID in the subject of the mail, and requested the users to reply to that mail by appending either : A for approve or : R for reject (case insensitive). But this again resulted in numerous typos.
You have basically two options
have your users reply to the email with Accept or Reject like you said. In this case, you will have to validate whether the email account in the FROM field has the right to do so.
have your user click a link. In this case, you will HAVE to make the application validate the user based on his login credentials.
There is no other way to go about this. You either have to validate the email sender, or the person has to be logged in to the application. There is no other mechanism available in this scenario.
There might be different ways of implementing these two options, but those are the only options you have.

Validate Yahoo and Gmail Login

I am required to write a small webpage / utility for both Google and Yahoo to validate their email addresses. Suppose I give two textboxes, one for Yahoo and the other for Google. When the user provides the email addresses and hit the GO button I want to show if the provided emails actually exist and are valid or not. Plus, I would also like to show any publicly available information like Name, Date of Creation of Account or anything else that is available.
I have tried searching the net but was unable to find any helpful material. Hence asking the question here.
Sounds like you need to implement oauth in your application. By doing so, the user can click on the button of a network and login there. The user will be redirected back to your application with some details (depending on the settings), in most cases you will get the email address and user name.
The simplest way to implement oauth I found was with Simple Authentication: https://github.com/SimpleAuthentication/SimpleAuthentication
An implementation I made: http://www.zonneprijzen.nl/Account after login go to: http://www.zonneprijzen.nl/User/Edit
Hopefully this solved your problem.

How to recognize returning Facebook User using the Facebook Login Widget

I am implementing the Facebook Login widget inside my ASP.NET 4.5 C# web application. When I clicked the login button I eventually get the accessToken. My question is regarding making the user persistant in my application.
There is data that is associated with the specific facebook user. when the user log off and log in back (assuming that the cookie might be deleted), I want to be able to recognize him again to display the relevant information.
I know that I need to use the database, but what is the best practice to do so. Should I use the user ID or email address as a unique user identification string?
I am using MySQL as the backend.
I have been working on a similar application which uses either Facebook (OAuth), Google (OpenId) or a manual registration login approach.
My prefered solution was to ask the user for their email address, you will need to request extended permissions on the email field from Facebook as it is not offered up by default.
http://developers.facebook.com/docs/authentication/permissions
My table structure looks like this.
User
Id (int)
Email (nvarchar(256))
FacebookToken (nvarchar(256))
GoogleToken (nvarchar(256))
The advantage to this method is you are able to link up your users to the right account if you decide later to add another authentication / identification service or roll your own. It won;t matter if they login to FB, Google or Twitter - you always know whcih account to attach them to.
It is also useful to have an email address for each of your users regardless.
Regards
Steve

How do I enable users to send email from ASP.NET MVC?

I'm developing a web application in ASP.NET MVC, and I want users to be able to click on a new link and have it send an email through their default email client with information already filled in, how do I do this?
How would I do it if I wanted an email to be sent out when a new ticket was submitted in the help system?
From MSDN:
<a href="mailto:user#example.com?
subject=MessageTitle&
body=Message Content">
Contact Us</a>
If you wanted to send this email to all users of your application, you'd probably need to automate that part into a service that sends email automatically. You can send email through .NET without any interaction from the user.
Without having the particulars, I see you could do it as follows:
User adds Ticket to the database.
Asynchronous Service polls database for changes to that table.
When it encounters a new ticket, sends an email to a list of users using information from this Stack Overflow question.
The list of users would come from the database, or whatever mechanism you have in place to authenticate and authorize users. If it's Active Directory, it would come from members of that group.
Update
If the user wants to share that email with others, then why not let them pick who they want to share it with in Outlook?
At that point, you can leave off the email address and they can choose it when it pops up in their email editor:
Contact Us
That produces the following when you click on the link:

How to get the incoming email address -Sharepoint?

I want to send the email to the sharepoint adminsitrator when user clicks the form button. How I can achieve this ?
The simplest solution for this scenario is to create a workflow with SharePoint Designer 2007. Here is an article that describes how to create a workflow that sends an email. You can manually choose administrators you want to mail, but it is much better approach to create a SharePoint group for admins and send an email to this group.
Make sure you have properly configured SharePoint outgoing email settings.
Upvoted Toni's but since the OP tagged it as C#, the function to send emails using the Central Administration is called SPUtiliy.SendEmail. To grab the email of the user (if you dont know the email) you could go with something like SPContext.Current.Web.AllUsers["DOMAIN\login"].Email (not test environment here, syntax may be off)

Categories