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
Related
I am not sure do i need to configure some mail server (like james) to send email from java api
like explained at this Java email send code example
No but its not a good idea.
When you want to use javax.mail session you need a mail server which accepts smtp connection from your app. This is preffered why.
But you could also write a socket based adapter which directly tries to deliver the mail to the receivers mail server by connecting by smtp and handle the protocol your self. That is theoreticaly, because most email server would not accept your application, because there spam protection will block you.
So my advice is. Don't think to much about this. Use a locale mailserver like james or one of the millions smtps proxies out there for development. And later in production change configuration to a well setup mailserver (most called MTA) where you can be sure that your mails will be delivered.
You do not need to set up one yourself. Mail providers, such as GMail and Outlook for instance, expose their own mail servers which you can use to transmit email messages.
Note however that in such cases, email transmission might eventually be blocked so as to discourage the delivery of SPAM mail.
yes :)
in this example it is installed at localhost, so mail is passed to another service within the same box. of course, you can use an external server, too - for example if you have a development system home, than utilize the mail server of your ISP.
I have working code to send mail using gmail smtp. It's working on my machine, but when I'm trying to run same code from my office system, then it showing error Unable to Connect SMTP Server. So, I was wondering, is it possible to send mail by bye-passing local/office network ? Any work-around ?
PS: I can't use my corporate email address, since it's internal task.
What you need to do is install a mail server on your machine and use that mail server to send emails. There are a lot of opensource and/or free options available. I have used hMailServer in the past (on Windows7), and it seemed to work for me, just the way I wanted it to. One possible downside of using this approach is that your emails may sometimes end up in the spam folders of your intended recipients.
However, you will need Administrator privileges to install most mailservers.
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.
I have used java mail(com.sun.mail.smtp) from my struts project. Mail is sent successfully but the receiver end the mail so delayed. It will take 2 or 3 hrs.
When am using PHP mailer with the same smtp settings , there is no delay, mail is working perfectly.
Anybody facing this issue, know what is the reason?
Javamail doesn't store and forward messages. So if you have have successfully sent the email to the mail server by calling Transport.sendMessage() and not receiving an error. It's sitting on the mail server waiting to be delivered. You'll need to check what you have set as your smtp server, user name, and password. Those are what you send to Transport.connect(server, username, password). Make sure they are the same as the ones you are using in PHP. If you aren't setting them in PHP then I bet you aren't using the same settings and hence why one server takes longer than the other.
Put some timing statements around the calls to Transport.connect(), Transport.sendMessage(), Transport.close(). See how long its taking to make it through that section. If its taking really short time then you know the error exists on the mail server side. And I bet you aren't talking to the server you think you are talking to.
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.