I have a date picker and time picker in my app and I'm trying to send mail as described here which contains the date as well as the time in the body of the mail.
So, Now my question is how to disable the body part of the email as the user shouldn't edit the date or time once it is selected from app.
What's the point of security in this ?
Code:
var mailto = new Uri("mailto:?to=me#mysite.com&subject=Date Selected :+datepicker.value+");
await Windows.System.Launcher.LaunchUriAsync(mailto);
The way you decided to generate the email, you don't have any control over the email client from that point on - you have called an external process and passed your parameters to it. The user could do with that email whatever he wanted or even delete it without sending, without you knowing about it. Also you are depending on the user having the system setup correctly for this link to work.
To keep control over the email you are sending you shouldn't depend on external applications, therefore the solution with sharing won't help you either, even though it's prefered in Windows Store apps over the one you are currently using.
If you really need to have the email sent unchanged, you only have two options:
Use a client side SMTP library for sending emails. The only one I know of for Windows Store apps was released by Limilabs. The downside is that you need to configure your app locally with SMTP server settings.
Send a request to a web service and send the email from there. This is probably the best approach, since it is completely under your own control and doesn't require any additional configuration on the client side.
AFAIK you cant disable the recipient, subject or body of an email.
If you want to detect an edit, then you can add a checksum to the body.
Related
I work with a dozen pieces of equipment whose operating software has the option to send e-mails on error. I would prefer to capture the details of that e-mail on the host PCs that run them (i.e. for logging, communicating details automatically via Slack, etc.) rather than them going to an inbox somewhere.
Is there a way to have the software e-mail an address that is essentially a lightweight piece of code running on the same PC mimicking something like an SMTP server (that will allow me to get after the message's contents)? Other solutions I have seen are along the lines of setting up a full-blown server which seems like overkill.
You may configure SmtpClient to save email to a specific folder instead of sending it over the wire. Check this answer.
Also you must design your system in the way it could work with different implementations of your 'sender', so that you can replace it when you need that, for example during testing. In this case you can easily provide proxy implementation that will capture email content and then send it to localhost, or add aspects (make retries, logs performance...).
I'm building an asp.net application for a client that requires a confirmation email to be sent. I've gotten the code working but the only problem is that I can't get the code to work with their web host (godaddy). Is there a way to send emails with the from address marked as the clients' without having to use godaddy? (essentially faking it)
Be careful or you'll lose your emails to spam filters.
Specifically, see the Reverse PTR record discussion here:
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html
We have a website sending mail alerts to end users. The site has been developed in c# ASP.NET.
I want to find the best way to send the email alerts to my users. Making sure the mail is not trapped in any spam filters. I read on the internet it is best to sent the mail directly from the web server and not route via an SMTP mail service such as google apps or Postini.
Can anyone tell me if this is correct?
First of all
Making sure the mail is not trapped in
any spam filters
Is not possible - otherwise spammers would do this. You just have to make sure you're domain isn't associated with any spamming activities and watch for keywords within the email.
I read on the internet it is best to
sent the mail directly from the web
server and not route via an SMTP mail
service such as google apps or
Postini.
This point doesn't make sense - your e-mail will never be delivered if it doesn't get routed via an SMTP server, the average message will pass through multiple on its route to the recipient.
The answer is to not actually send email and let someone else deal with the problem. I'd look at postmark or Amazon's simple email service.
We had problems that mails sent with local server often get trapped in spam filters until we implemented SPF on our mail server.
http://en.wikipedia.org/wiki/Sender_Policy_Framework
But I am not admin, that's just what our admin said, and after that we have no problems anymore.
btw. maybe would be better to ask on serverfault.com
As part of my app's config process, I have a sanity checker that validates all user-supplied data. This includes email server settings that the app uses to send email.
I'd like a simple sanity check on those settings without actually sending any email. It'd be great if this could support all standard flavors of SMTP setups including those with authentication/ssl/etc.
It doesn't need to be exhaustive but the more coverage, the better.
Currently all I do is verify I can open a connection to the given server on the given port. Something a little deeper would be nice.
Note: I'm not trying to validate email addresses--that's not relevant to this question.
You just open a raw connection to the server & port that the user supplies and do a
HELO Server.Domain.Com
Mail From: validaccount#domain.com
to see if you get a valid HELO response & Sender OK Response
(if smtp authentication is enabled).
Same as you would do if you telnet direct to the server.
http://www.petri.co.il/test_smtp_service.htm
This might also be useful
http://qmail.jms1.net/test-auth.shtml
I'm sure someone brighter and more qualified will pipe up with a better answer. However, at first blush I'd say that you cannot verify the ability to successfully send email without actually sending an email.
However, if you want to automate the process, you can have a 'MyApp_SanityCheck#gmail.com' (or your local domain) address.
Then you can create a watchdog application that monitors that email address, or just a simple app which programmatically interfaces with that email address and checks if an email was received within X minutes. This way you can be 100% certain that the emails are able to be sent out.
This link shows how to programmatically check gmail addresses.
An important note: If you application is sending out external emails, then it would be best if the email address you use is external, because it is possible that your server could be unable to send external emails, but internal emails go through just fine, and in that case your sanity check would send up a false positive.
I have a job that runs which sends out emails to our users to which starts off a work flow process in our company. Periodically, a user will swear up and down that they didn't receive the email - though, when we go to the mail administrator to pull an exchange report, 10 times out of 10 it's in their deleted items. :P
I'd like to be able to programmatically verify that messages sent via .net C# (System.Net.Mail I think) reached the user's mail box.
It's exchange 2007 and all messages are internal.
You can't with System.Net.Mail. You'll have to dig through Exchange's APIs to determine if an email is present in someone's email account.
http://support.microsoft.com/kb/813349
Set an account for catching all bounce backs. In this way you will know which ones reached and which ones did not. This is the best way to ensure emails reached.
Alternatively you can add read reciepts via message headers(by setting the Disposition-Notification-To). but again, user can chose not to read it...
I see two ways to do what you want:
Send emails with "delivery confirmation" On (not "read receipt", this can be dismissed by the user as CoddeToGlory said). Then it's jut a matter of monitoring the mailbox that receives these confirmations via any way it's appropiate to you: Exchange Web Services, Outlook+COM or VBA, MAPI, ...
Use the powershell interface to Exchange and capture the output of Get-MessageTrackingLog looking for StoreDriver + Deliver events.