Is it possible to track the smtp host by code in java? - java

I need that the application be able to track the smtp host by the email account, because it have to be capable to work with any mail account.
There is a way to do this?

Short answer is: no you can't.
To some degree you can get a smtp host from an email address, but not all email providers have an smtp server, and most email providers will require user specific authentication when using their smtp servers.
It's still possible to send mail from your computer when your email provider doesn't provide an smtp server because most Internet providers also provide you with an smtp server. You can't determine this smtp server based on someone's emailadres.
If your application always has to be able to send mail I would look into a free smtp server somewhere, or host your own.

Related

Jmeter Error sent email on gmail

today i'm researching about the jmeter.
connect the gmail
login
send email
I passed 2 step and got error "java.net.UnknownHostException: mail.google.com" on step 3
Login :
Send Email :
I connected the link "mail.google.com" on the website.
Can somebody teach me what am i wrong ?
I would recommend using SMTP Sampler instead of simulating sending an email using web interface.
The relevant configuration would be:
Server: smtp.googlemail.com
Port: 587
Address from: your Gmail address
Address to: recipient address(es)
Check "Use Auth" and provide your full GMail username and password
Tick "Use StarTLS" radiobutton
Other fields are pretty much self-explanatory
References:
Set up Gmail with Outlook, Apple Mail, or other mail clients
Load Testing Your Email Server: How to Send and Receive E-mails with JMeter
I know this is not an answer you will like, but you should not be pointing any performance testing tool at a server you do not own, control or manage (or have permission from the people who do). In addition, Google's own end user agreement prohibits this behavior, supporting automation only with their published API set. License-wise and ethically, this is a problematic set of behavior for performance testing.
If you wish to experiment, then consider setting up a LAMP stack box inside of your own domain/control with an SMTP relay, pointing to mailbox destinations on that server. If you must test routing then setup two email servers with destinations on the opposite host (easy with two virtual machines).
Note, SMTP supports direct addressing, such as [name]#[host|IP address] so you can control directly any email routing to outside mailboxes accidentally and SPAMming individuals or organizations. This also avoids the problem of clogging up an SMTP relay with thousands of messages undeliverable due to lack of a valid address - this last condition will slow all email delivery for an organization and if not addressed can grind delivery to a halt before the first undeliverable messages start failing out after the delivery timeout is reached which is typically around 72 hours.

Local SMTP server for ubuntu

I'm using a Java class that sends mails using JavaMail. I really need to use it even though authentication is not yet implemented. Basically it just has SMTP hostname, port, from, to, subject and body.
I need a SMTP server for it. Most of the ones I've tried use authentication.
Does anyone know maybe a local smtp server for ubuntu?
It doesn't have to be very complex/secure because it's just a proof of concept.
Something like sending a text email from my gmail account to my yahoo account. Thanks

How to create a simple pop3 email server?

The server has to handle requests from a pop3 client. I was able to create an smtp email server, which can handle Telnet communication.
For the pop3 server, I have to support a pop3 client (any one). I tried Thunderbird, but I don't know what kind of stream is coming from the Thunderbird and how to properly handle the communication between the server and the pop3 client.
I could use any pop3 client and the server doesn't have to handle encryption. I just need something that is simple and works.

Java mail: sending email without SMTP

I want to send an email without using SMTP protocol. Is that possible to implement using Java? Since, my remote machine does not have access to google, yahoo and other accounts. and even my office mail can not be configured using SMTP server due to some security issues. Is any other way to send an email from remote machine.
The JavaMail section at java.sun.com lists many third party products that plugin to the JavaMail API. Hopefully one of those will fit your needs but I can't be more specific because you don't say what non-SMTP sending options you have open to you.
You could setup Your own SMTP server on remote machine, IMHO, it is better than incorporate it into program directly.
I want to send an email without using
SMTP protocol. Is that possible to
implement using Java?
With Java you can implement any Layer-5 network protocol.
ALL mail servers using SMTP to receive messages. At any time you have to connect with SMTP to the destination mail server.
If you cannot get out from local network to the Internet with some services you will need a proxy or network tunnel to connect the destination.

Sending email in Java

I have read that to send email in Java I need to obtain my ISP's SMTP address, but if I am intending to host my web app online, will this be my hosts ISP SMTP address?
EDIT: So I need to find out my clients ISP's SMTP address and send via this?
JavaMail is the built-in API for e-mail.
Ask your ISP if the host runs sendmail or equivalent locally (the web server host). It may be an advantage to hand off to sendmail as early as possible. In other words, try "localhost" as the SMTP server name.
Why? JavaMail is a simple SMTP client. It doesn't deal with DNS MX records. It doesn't have a built-in capability to queue mail if the SMTP server is unavailable. There's the default Java infinte DNS cache so that a DNS change to the SMTP host won't register with your app (tunable, but one more tuning to do). These are things that a local sendmail (or equivalent) process will do.
So if you can hand off the e-mail to a local sendmail/equivalent, that may improve e-mail delivery reliability. Assuming the local sendmail works, of course. It's how we configure some in-house apps that uses JavaMail to send mail and fixed all the above problems.
No, unless your webhost is the same as your ISP or your webhost also offers SMTP services.
In response to your edit, yes you need your ISP's SMTP address by the sound of things.
It will be the SMTP address you want to forward email through.
If you want to send email through your ISP account then it will be that SMTP.

Categories