Sending an email from a UITextfield [closed] - iphone

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'd like a user to be able to enter a string into a textfield, press done, and have the data emailed to my inbox, but I have no idea how to go about doing this. Could somebody describe the basic steps I need to look into, things I need to learn, recommend tutorials, sample code, etc. I would like to avoid opening the mail app if possible.
Thanks.

Look in the apple documentation for UI Message framework at http://developer.apple.com/iphone/library/documentation/MessageUI/Reference/MessageUI_Framework_Reference/MessageUI_Framework_Reference.pdf, they hasve MFMailComposeViewController etc, I never used them, they provide UIs to write emails, I dont know if you can behind the scenes make it send an email (maybe its possible), youll have to look through the docs and figure it out. If it doesnt do it for you, you can always make an SMPT protocol and send the emails yourself...(you should be able to find something of use in the UI Message framework though i would think)

If you want the email to come from the user's own personal account then you have to either:
Use the built-in MFMailComposeViewController (which puts up a mail editing page) or
Use an SMTP client library like http://code.google.com/p/skpsmtpmessage/. However, in this case, you'll have to get SMTP account information from the user (i.e. userid, email address, password).
If all you want is the body of the text box and you don't care about the return email address you can set up a simple mail re-sender web service (there's tons of PHP/Ruby/Python code out there for sending email from a script). Then behind the scenes your iPhone app fires off an HTTP request to your web-server who then formats it as a mail message and forwards it to you.
This is probably the most user-friendly since it requires minimal input from the user, but you may want to put up safeguards (like using SSL and/or authentication) to restrict access to the web-service URL from only your app.

Something like this should work:
NSString *s = #"mailto:addressee#apple.com?subject=iPhone%20Question&body=Where%20is%20mine?";
NSURL *url = [[NSURL alloc] initWithString: s];
[[UIApplication sharedApplication] openURL: url];
That's about right, I think. The %20's are for embedded spaces -- if you put real values in place of the ones I have hard-coded above, you will want to do text-replaces for spaces and other problematic characters in the URL. I'm no expert, perhaps someone else can point to a guide.
Note that the application is exited if the openURL call succeeds, so you don't really have to worry about cleaning up things like "url" above.
Alternatively, that MFMailComposeViewController referenced above might be the right way to go -- I'm going to look into it.

Related

Conditional reply to e-mail [migrated]

This question was migrated from Stack Overflow because it can be answered on Emacs Stack Exchange.
Migrated last month.
I use notmuch in emacs for e-mail and I love it, but I need help in customizing how it handles replies.
I use two e-mail addresses, a personal one and a work one. Most of the time, when I get work e-mail my e-mail address is in the header, and the automatic reply functionality works fine. However, often a work e-mail will come in without my address in the header: for instance, through an Outlook mailing list. In this case, the reply function defaults to my personal e-mail address, which I do not want.
I've already created a function that allows me to change the sender address with a keybinding, but in the moment it is easy to forget to do this. A more seamless experience would greatly improve my life. How can I customize the reply functionality, perhaps conditional on tags or on whether the sender's address contains my work domain?

Is there a need to expire email verification code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I've registered a GitHub account to test their email verification process. So:
They've sent me an email with a link, containing my username and 40-chars code, like:
https://github.com/users/USERNAME/emails/120066679/confirm_verification/47889d71648523e5d99db5b969f59809c2715fb6
I have not followed the link
4 days later, the've sent me another (a reminder), that I have to verify my email, containing link with another different 40-chars code
So, what was the purpose of changing 40-chars code? As I remember, other services, used to expire verification code anyway. If there is already a username in verification link, is there really a need to do that? In case of brute force, I can just count failed attempts related to specific user and block it, right?
P.S. Also interesting, what is the purpose of emails/120066679 in link? (which is similar for both letters)
There are several reasons why quick expiration of verification codes is the best practice.
If protection with a verification code is deemed appropriate, it's safest to make it not only complex enough but also valid for minimum amount of time. If you only make the code work for the time needed (usually really short), you diminish the risk of someone abusing it. (For example, someone could programmatically 'guess' the codes - the more time for this exercise, the higher chance for success.)
Also, it's not efficient to store data of this kind. It's used once, it doesn't contain any actual information and as soon as it's used, it's ready to be "thrown away". It's not a good practice to store anything that doesn't add value when stored.
In addition, it's fairly rare that users don't use the codes immediately/soon. For the small percentage of cases where the code expires by the time the user tries to use it, it's more efficient to generate new ones.
Well, the purpose of an email validation link is to make sure that you actually own the email. Most validation links simply contain some secret that they send out your way, only in the possession of which may you verify the email address.
The reason they changed the code is because it probably expires. In that case you could not activate the account, so they sent you another in case you'd like to continue.
What if they don't send out a secret like this then?
In that case there is nothing that prevents an attacker from "verifying" emails that they actually have no control over. They could just visit the url with the username plugged in and activate the account.
Normal users would not do this, but spammers might.
For the case of brute force:
If the secret is sufficiently random, and the keyspace is large enough, trying to guess it is a fool's errand.
We can assume this is a random 40 hex char number, which gives us:
16**40 == 1461501637330902918203684832716283019655932542976
possible values for it. It is safe to say that no one will guess this number in the near future.

Giving an automatic email reply based on reading the subject line

I have been toying with this idea for few days now.
What I want to do is: I have a powershell script which sends mails mentioning status of some links which I am monitoring.
I wanted to add its functionality. I wanted to add a feature like, when a user sends the mail to a particular email ID with a subject line like "Status", it should send the user, the result of the powershell script.
From my perspective, an IMAP configuration needs to be done in the script. But just wanted opinion if this idea is feasible or not. I have IMAP configured in my organization. I just need to learn how to configure the script with IMAP settings so that the script can send automatic replies after reading the subject line.
IF this is possible from any other technology, then I would like to learn that as well.
EDIT:
Its not a duplicate, because here I want to know pretty basic stuff, like if its possible, and if it is, then what are the technology I need to use to make it possible. Let me know your suggestions.
I saw the duplicate question as well; well it hasn't been properly answered and the links given don't work.
Please help me here.
Thanks in advance!

How to build realtime push notification feature like facebook does? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm going to build realtime push notification feature for my web application ( a small social network) and I don't know where to start.
This is what I want to build: there are like buttons, comment forms, ... Users click like, write their comments and (relatively) immediately, on the owner's browser shows the number of new likes and comments, ... Something like that.
I've read about socketIo on nodeJs, MeteorJS but unfortunately, they need WebSocket supported by mordern browsers. I've just read about Comet technic and find it pretty easy to apply. But i'm not sure it will performs well because Comet relies on long-polling connection (correct me if I'm wrong).
In addition, I think facebook is using Comet for its push notification feature. Through console tab on firebug plugin I can see there's alway a holding connection to facebook.
So can anybody show me a technic, a model to develop a feature like that?
A promising idea is to work with the HTML5 notification API; it's perfect if you want notifications to pop on the user screen as long as his browser is running (even if you're surfing another website or if all windows are closed).
http://www.paulund.co.uk/html5-notifications
However, if what you want is to update different parts of your page asynchronously (without refreshing or pushing a button), you should use together :
Ajax calls;
Listeners and observers.
When you Ajax calls retrieve particular types of json data (for example), it can trigger appearance of a badge (listener) with a number of new notifications, or so...
With JQuery installed, you should be fine...
Even though it's often not the case, sometimes, for simple tweaks, it's easier to code the job done...
You can start here :
How implement a "observer" in Jquery without plugins? (it's old, but interesting)
Or see this page :
browser instant updates with ajax/jquery
(incredible how often google queries return stacko' pages)
You should check out MQTT. It basically works on the Publish-Subscribe model and is very easy to use. This protocol has a small footprint and consumes less bandwidth. Facebook's Messenger uses MQTT too.
you can use an ajax call coming into (for example) a php script on the server, which keeps the connection open and only replies if and when something needs to be displayed to the user. should nothing happen within a certain time, the connection gets closed and the client fires a new ajax call.
note that this only addresses the client/server communication, you would still need a notification method inside the server to wake up the php script if you want to avoid having a script constantly polling the database, but there are quite a lot of soultuions to this and they depend on what language you use on the server.
I have got an idea, it is simple but it may work. Why don't you hide notification bar as Div tag and design it with css to make it look like notification bar. Then whenever some user likes or comments about the page, write php or js function and connect it to like or comment submit button that will reveal page owners invisible div to visible. And I believe , depending on what you use, I would probably prefer php session() to Identify if page owner is online and can get notifications. moreover, if you need to track statistics of the page, you may create a small database that holds, page id and user comments. You can use this database to push multiple notifications on that hidden Div. you can use Jquery to make it move like Facebook if you want to. I m not %100 percent sure if this is the most optimized way to do that but it is possible. By the way, I surfed some to see what people use to do that. surprisingly I couldn't find something as well.

Email message recall does it actually work? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I was asked to recall a message I sent out to remove some personal info from it and replace it with a generic made up person as an example.
Does message recall really work?
It's my opinion because you get told a message has been recalled it just causes you to want to find out what was in the original message. All you do is find someone who had already read it.
Can exchange server be adjusted to not tell users when a message is recalled or replaced?
What about bcc, recall doesn't seem to work on these and global emails tend to be the ones you really need to recall.
EDIT Also people with smartphones which is common now don't seem to get email retrieved from their phone either
In most cases, it's too late, it just let's me know there was an email you didn't want me to read.
Only works on unopened mail, for users of MS Exchange/Outlook.
read this blog post and comments for more information.
To add a bit of information, if the message is displayed in a preview pane, it is considered read making recalling impossible.
We did some testing just yeasterday and discovered that the recall feature is pretty lame. As mentioned above it is only recalled if it is unread (or unpreviewed). In the case where it has been read, the recall only makes the message MORE obvious. Not the desired effect by far.
Only works on unopened mail, local to the server you sent it on. (as far as I know, I suppose it could work on server farms/clusters too?)
If the recipient is offline and message is not delivered to his PST by the Exchange server, then RECALL works and you get the message accordingly.
Thanks & Regards,
Ajay
Yes it is true that the Recall This Message Outlook functionality very often does not work.
WinDeveloper just released a server-side solution for Excahnge 2007/2010. It works equally well for both emails addressed to local recipients and for emails sent to foreign recipients. For more details:
WinDeveloper vs Native Exchange Message Recalling
http://www.windeveloper.com/recall/recall_features.htm
Message Recalling Works! Here is how
http://www.windeveloper.com/recall/recall_howitworks.htm