I'm trying to find an example on how to implement a Java client (using javamail perhaps) that retrieves emails from postfix, but unfortunately I haven't found anything usable in 8 hours.
I already managed to make an smtp client to send email to my postfix server running on localhost but still no success on getting that mail I sent back. With the imap client I always get some problems with the store and get connection refused.
Any suggestion?
Did you find the JavaMail FAQ? There's lots of tips there, including tips on how to debug and what additional information we would need to see to help you figure out what's wrong. So far all you've told us is that something's not working. Without more details, we can't offer more than general suggestions.
Related
My program sends mails. When developing I used my gmail account to send the mails. Going in production, I should connect to the clients mail, which is a Roundcube Webmail. I set up the configuration with the information I get from roundCube. I don't get an error, but the request never gets processed.
I have tried changing ports and protocols. I also checked everything on the roundcube mail if I could find a setting that needed to be turned on to accept the incoming request. Unfortunaltly, I cannot seem to send the mail via roundcube. To be clear, when I use my google mail settings it works fine.
Do I need to changing some setting on Roundcube? Am I misconfiguring something? Does anyone have experience with connecting to roundCube webmail and tell me what I am doing wrong? You can find below my application properties. If you need anything more, please tell me.
spring.mail.port=587
spring.mail.protocol=smtp
spring.mail.host=mail.domain.eu
spring.mail.username=email#email.be
spring.mail.password=password
I am very beginner to Selenium, java and SQA automation. I wanted to do automated EMAIL VERIFICATION FROM GMAIL ACCOUNT.
Help me please..
For this I found & followed a tutorial but failed. I don't know what happened to my code even I can't understand the error.
I followed this link step by step:
http://www.abodeqa.com/email-verification-gmail-account-selenium-webdriver-java/
Here is the whole code, which I tried.
http://www.abodeqa.com/email-verification-gmail-account-selenium-webdriver-java/
I found too many errors but I am including some main & top errors at following:
Could not connect to the message store.
javax.mail.MessagingException: Connection dropped by server?; nested
exception is: java.io.IOException: Connection dropped by server?
Also, Being a newbie I feel this tutorial too much difficult. Can anyone please share some other easy & brief tutorials with me ? Please..
Thanks in advance!
To lookup emails on a gmail account I recommend you use the java gmail api. Tutorial here: https://developers.google.com/gmail/api/quickstart/java
You should be good with that tutorial, the sample code works (you will need to setup correctly your gmail account to permit access and also create the corresponding credentials).
Probably you will need to call a couple of methods, one to search for the email you are looking for, and then another to get the detail of it.
Full docs of library here: https://developers.google.com/resources/api-libraries/documentation/gmail/v1/java/latest/
I'd like to write a program, probably a servlet or something to run on the a google app engine that I can send an email to. So not a program to send email, but one that can receieve it and parse it.
My question is, what code or API are out there that can receive an email?
Basically on your google app engine you can use an inbound mail service.
Please see this documentation for more information.
http://code.google.com/appengine/docs/java/mail/overview.html#Receiving_Mail_in_Java
You cant send an email to a program, you send an email to a server, so what you are looking for is a way to access an email server via your program. Unfortunately there is no single solution here, you need to configure your program for every different email account/server you want to access. (If you have ever set up an account in outlook or something like it you will get the idea)
For example here is a link to the gmail api, you could use this to access gmail accounts
http://code.google.com/apis/gmail/
You need to have a mailbox to send message there and you could read messages with the code like this: http://www.java2s.com/Code/Java/Network-Protocol/GetEmailMessageExample.htm
This can be done with a built in Java library.
javax.mail
Check out this link. It should be able to help you get started.
This won't work for every mail server, but depending on your setup it might help.
To send an email to a Java program, that program must be running. Generally that means a server style (aka service) receiver is favored.
For the email to be received, the Java service must understand an email protocol. There are a number of protocols, but SMTP is the standard for receiving email. Once you have a service that understands SMTP protocol for receiving email, you have written a mail server.
Note that most people don't care to write a mail server, as a mail client needs to connect to the server and pull the email to make it readable. Keep this in mind when designing the solution to your problem.
Ok, so two questions. I'm able to access and read my new email inbox using javamail but:
If i try to read the messages already found by javamail, javamail seems not to be able to read them again.
Javamail cant read messages with numbers in the subject.
How can I make it so that both of these are possible?
Thank you
UPDATE:
Fixed question 1, I was using gmail and the setting needs to be configured so that the messages can be seen by JavaMail once opened. Still stuck on the second question though :(
You should be more specific with your question. You are using a POP3 provider? an IMAP one?
I use javamail and have processed millions of real world mails many of which certainly contain numbers in the subject, so I suspect it's not a javamail problem.
If you think so, add more data and stack traces etc
I want my Java application to send out emails to users. But I cant get a good solution.
Now, I got some on Google but they use a SMTP server which I dont have. I was wondering if setting up one on my Linux machine would be easy?
So, I am using mailx now to send out emails but it sends emails from root which is definately not good. Is there any way to send out emails from a proper email using java? like you can do in php and other languages?
Use commons-email to send email from java in a simple, straightforward way (see the docs).
You need an SMTP server always - even in "php and other languages", but perhaps you don't know you need it, because it is bundled in your LAMP package.
One solution is to use google as an SMTP server. Either via your account, or via google apps. Otherwise setting up an smtp server (postfix for example) linux appears trivial, but isn't - you have to take into consideration many things - see this post by Jeff Atwood.
So ultimately, I'd suggest using the options provided by google.
if you'r looking to host your own mail server, then apache james is a pretty good option.
or other solution could be using a third-party mailservers such as gmail or yahoo; and use the JavaMail API to send emails.
If you don't have an SMTP server, Asprin is a send-only SMTP server, which is a pretty good fit. It suffers from the same problem any do-it-yourself SMTP server will, in that it will look more like a Spam source, so using a proper SMTP server used for e-mail should be done if possible.