Dummy email address and Email parser - java

If you're not interested in helping a beginner in email parsing, don't read further.
I have been programming for a while so I know the gist of things. But, I'm really interested in creating a dummy email address and then set up a parsing program inside of it (if thats even how you do it)
Scenario:
I have an email account which receives certain emails which need parsing. I want to be able to forward those emails to a "dummy" email address which is basically just a program which parses the email for sender, subject, and message. I would prefer to write a runnable jar program or something on windows but I'm willing to do web programming if need be. Android programming is also an option for me.
What would I do to get started? I'm not asking for anyone to write out everything, I just need a starting point for all of this.
Thanks!

What you describe can be solved like this:
1/ Create a catch-all address *#yourdomain.com which will receive all incoming e-mails except those who match an existing email address (e.g. contact#yourdomain.col)
2/ Pipe all incoming e-mails to a script with Procmail
:0
| `/home/foouser/scripts/footool/footool.sh`
3/ Let the script process the e-mail (read headers, save in db, ...)
Another, probably much more easy solution would be to use a web service like cloudmailin.com for this. If the structure of the e-mail is always the same, an email parsing solution like mailparser.io could help you as well.

Related

Devise customization for registration and confirmation

I was just about to follow this tutorial:
http://eureka.ykyuen.info/2011/03/03/rails-%E2%80%93-add-custom-fields-to-devise-user-model/
But then realized that my Devise needed some customizing. I am very new to Rails, so sorry for anything in advance.
What I am doing:
I need to create a site for a Minecraft server a friend and I are making. I set up devise with no extras, just an access level (admin, moderator, developer, ranks, etc.). I am using mongoid for everything here.
What's the problem? I need to make sure that the user really owns their minecraft account! The way I want to do it: In game you type /register [email], you are sent an email with a confirmation link, you click it and done, you are now registered.
What I am asking: Can someone guide me as to: What I need to do in Java, simply what's needed to be done, not the code (in PHP I've done this before, I opened up a connection to a page, I sent username and a hash as parameters), and what must be done in Rails (Change up some views, totally redo the insides of Devise, just what's needed, and some examples). I'm quite new to rails, so please be nice to my brain! Thanks!
I understand it's a big request for help, but if you have some idea of how this can be done, please help. Thank you for reading!
Edit:
Okay... I really am getting desperate here, I will make it as simple as I can:
How do I customize Devise confirmation? I want it like this: from JAVA I can create a user (with only his username and email) who can't log in because he hasn't confirmed yet. When the site gets this request to make an account, I want to dispatch an email with mailer with a confirmation link. From there, instead of just going ahead and verifying, I need them to type their password and reconfirm it, because remember: the account was created without the password, only username and email! After they fill in the form, their account is active!
Please help, I need this done quickly, my app is quickly growing and it will be a hassle to change this all. Until someone can help me, to make things better in user I am using a method to get what display name I want them to use, right now it's set to email, after someone helps me I can finally make it username!
Thank you for reading, please reply if you know the answer or upvote so someone can provide a good answer!
(Assuming that you already added the username field to the User model created by Devise)
What I would do:
Create a simple form, no Devise at all, just a standard form that takes the username and the email.
Email the user. This email will have the Devise form and/or a confirmation link.
If placing the Devise form in the mail is not possible, have it displayed in the page linked by the confirmation email. Of course, you can now auto-complete all the fields except for the password.
With this approach you don't have to dig in the guts of Devise. Use it out of the box, but until the second interaction with the user.

How do I save a viewer response to a server?

If I want to save a response to a query on a website I'm coding to a server, how would I do that?
Here's an example. If I had a site with a "Rate us" form, and a person answered with a "AWFUL SITE!" how would I be able to save & retrieve that information?
There are several ways to do what you want to do. I'll describe two of them.
You could append each rating to the end of a file on the web server. This would be done in a server-side scripting language usually, such as PHP or ASP.NET, and you would probably want to set the permissions on the file so that it's not readable to everyone.
You could set up a table in a database (MySQL or otherwise) and add a new row for each rating given. Again, this would be done in something like PHP or ASP.NET and you would want to make sure you take precautions against SQL injection attacks (not much of a problem if you use PHP Data Objects rather than the deprecated mysql_* functions).
I would personally go for the second option as it's easier to manage and change, and it's easier to set it up so that you can store IP, name, optional email and message in every row. And like I said, you can add a new field later down the line without running into the obvious problems.

How to create email verification URL in Java?

I'm writing a web application in Java where at some point user can enter there email address to receive an email. My question is about the verification of this email address (so it's not about the validation!). I'm tagging this question also with google-app-engine, because the application will live there, but I don't think that matters too much.
Anyway, for people who have a google account I use the app engine's User API to verify that address, but for other people I would like to send a verification email, that provides them with an URL. Very standard I would think, but are there also standard ways to generate the URL? Or is just creating a hash of the email address, storing that in a database and putting it as a parameter in the URL sufficient?
I wouldn't use e-mail hash in verification e-mail. That would be to easy to guess and someone could actually try to falsify that.
If I were to implement it, I would add random GUID and store it to the DB for verification. I don't know if it is standard way to do verification or not...
Create a servlet that will check, given a key (say, some random string), whether that key is given out previously. The key needs to be crytopgraphically secure so that it cannot be guessed by an attacker wanting to pose as somebody.
Then, when someone signs up with an email, you send a link containing that key to the address they claim they own. If at some point in the future, the link you send arrives at your sever, you can record that event, and be confident that the email address is a correct one.

How to automate a text message?

I have a group that needs to send out announcements and current events via phone text message. I want to have a central phone number that when it receives a text message, it rebroadcasts that message to a growing list of subscribers. I'm hoping to use a Google Voice number to avoid buying an actual phone number.
Any ideas? I've thought about some type of Java/HTMLunit that continually parses the GVoice html inbox, but I just have that computer-gut feeling that there is a more intuitive way. I haven't been able to find a GVoice API, as I imagine that would be the trick.
Thanks
I've used a different approach. There's a number of E-mail to SMS services out there. So you send an e-mail (using standard JavaMail) to a specific address that is then associated with mobile phone numbers. I use TextMagic, but there are also other similar services out there. They also have API support, if thats what you'd prefer.

java: how can i verify an email address to be valid without sending a confirmation e-mail?

when people register to my website i don't want to send them a verification e-mail, i just want to check if that e-mail exists. is there a way to do such a thing ?
using apache-tomcat and java as my main programming language.
thanks a lot!
No. There is no way to tell if an email address points to a valid destination. You can check basic syntax, and that the domain has a record in DNS, but that's all.
You can at highest use regex to check if the address is syntactically valid and/or looking up the MX records if the domain is valid, but this still does not guarantee that the email address is legitimate and belongs to the registrant in question. There is really no more reliable way than sending a verification email and waiting for confirmation in a short time-span.
contrary to some of the uneducated answers you can TRY and connect to an MX server and use the VRFY command to see if the sever supports it. Here is a website that will do this for you as an example. If you look at its exchange with the MX server it actually does try and send an email but does a RESET before actually sending it. Testing it with my email address works but I don't get an email. So yes you CAN do what everyone else is saying you can't do. Use an address you know works for your domain, then use one that you don't isn't supported. You will get a 550 on the last RCTP TO command. That is how you know it doesn't exist.
I just wanted to weigh in and say that despite your reluctance to do so, PLEASE send an email and force the user to confirm that they have control of it before allowing that email address to be used in association with an account on your site. Why? Because not doing that, for any reason, means that users can sign up for accounts using email addresses that aren't theirs. They might do so accidentally, or they might do so very much on purpose (e.g., signing others up for accounts for any number of reasons); that's just not kosher, and websites that allow it are open to being reported to their ISPs.
(I say this as the owner of a Gmail account which, at least two to three times a month, is signed up for an account at some website that doesn't force users to confirm their email addresses in this manner. It's irritating, and it puts the onus on me to get the account removed from the offending website. I've now taken to recovering any passwords I can, logging into the account, and then changing the email address to "UNKNOWN#gmail.com" or something like that... it's sorta fun, but I doubt you want this to happen on your website.)
This has been answered already in previous questions here. Without a verification email, the best you can do is look at the email address and look if it seems valid. You can also check things such as the domain, to see if it exists and has MX records. Anyway, see https://stackoverflow.com/questions/3232/how-far-should-one-take-e-mail-address-validation and Using a regular expression to validate an email address
If you just want to verify that it LOOKs like a valid email address, there are many sample Regex's that will verify that. If you want to verify the user has control of the email address, you'll need to send something to it and craft a unique response to verify it.
i guess this is what you are looking for
http://www.strikeiron.com/Catalog/ProductDetail.aspx?pv=5.0.0&pn=Email+Verification
You can use the openid service to check for valids email addresses as stackoverflow does.
http://openid.net/
Email Verification services are very helpful in validating email address. Most of them performs 6 levels of verification like syntax validation, Domain MX record Check, Role based Account detection, Disposable email address (DEA) detection, HoneyPot/Spam track detection and deep level SMTP verification.
Most of them offers API integration, so, you can directly validate email addresses from your application.

Categories

Resources