User registration mail using any email id - java

I have a registration page on my site. The users who register in my site, I want to send them a verification mail. I am able to send ail using my gmail id. But when I use my site mail id say www.xyz.com then mail is not getting sent please suggest me how to get it done.

First of all make sure your mail server is running, and if it linux server then grep your email ID from logs what you found as below: Replace Your#emailid with your email ID.
For exim:
grep YOUR#emailid /var/log/exim_mainlog
In Sendmail:
grep your#emailID /var/log/maillog

If you can send mails using the G-mail, then there is no issue with your script. As you are having issue with your own mail server or mail address, Make sure that exim or any other mail server is running on the server.
Also the domain say xyz.com is pointing to the server if it is having a MX as local domain.
For checking A record dig +trace xyz.com .Make sure that A record is points to the server.
For checking MX record dig +trace xyz.com MX . Make sure that MX is like "0 or 10 xyz.com"
Instead if it is using remote MX then make sure that you are using mail server IP as the remote mail server in the script.
Try sending mails using webmail client and make sure that there are no current issues with the mail mail server. like poor reputation or else.
In case domain is having remote MX, make sure that the your server IP is not listed in the firewall block of remote server.

Related

SMTP code 250 but email lost at remote server

I'm experiencing a weird issue with my mail server. Currently i'm using Apache James as a relay to dispatch emails to an external mail server. Sometime it happens that even if I receive an SMTP code 250 from the external mail server, the email diasappears and never get delivered or it is delivered after a very long time. Point is: am i right assuming that until i receive the SMTP code 250 of successful delivery from the external server, it is not a problem of my mail server?
Even you get SMTP return code 250, it doesn't guarantee your email will arrive in final destination.
That return code means that the relay server ACCEPTS your email-delivery request. After they accept the request, who knows what happen after that. Several possibilities:
The remote server scan your email with AntiSpam daemon and (unfortunately) your email is mis-idenfified as spam. So they discard/drop it.
The remote server just don't like your email. Maybe your IP Address blacklisted. So they silently discard it.
The remote server is busy processing other jobs. So they delay your email delivery.
The server happily to forward your email to final destination right now.
Further info: Simple_Mail_Transfer_Protocol on Wikipedia

not getting mail from Java application using smtp

I have a java application which send mail using SMTP,but recently a modified its property file and restarted my tomcat server [although property change is a password change and is not related to smtp ].
now it is not sending mails :(
I checked my smtp server and tried to send mail from it.It is sending.
Any idea what went wrong?
any help would be appreciated
thanks in advance
Your SMTP server logs should tell you whether something was sent to it, and why it didn't relay the email.
If your change was password related, an authentication error may be the cause.
I would look at the following first:
Which credentials is your Java application using to send requests to the SMTP server?
Then, are these credentials still accepted on the server?
Finally, most SMTP servers will have a separate list of either included or excluded source IPs, from where to accept message requests, see if your Java app's source machine is allowed there.

How to use javamail to connect to ms exchange webmail?

I checked that I am not able to access the pop 3 port and imap port. I think I can only access via https webmail.
So for this case how do I actually connect to the microsoft exchange server and read the emails inside using java mail can anyone provide any specific code samples to achieve this?
Connecting to Exchange via OWA sounds like its going to be difficult; here's a post which deals with at least the authentication side of things.
In any event, you can connect to an Exchange server via IMAP if the IMAP service is turned on. Check with your server admin to confirm the service is running. If it is running, see this other post for how to set connection parameters.

how to send mail to localhost

I am using smtp protocol to send email via gmail . I want to send mail to localhost . What address I will give for localhost to get that email ?
What is localhost in this case? Your local desktop or a server?
The only way gmail is going to be able to send mail to it, is if you've got an SMTP server running there and it has an IP that's accessible from the Internet.
You can only send to localhost from a mail server running on localhost. Generally though you'd need an Internet domain for this instead.

How to check status of an SMTP server from Java?

In a Java program, what is the best way of determining if an SMTP server is ready to accept and send an email?
You can use JavaMail API and try to send an email.
If you don't want to actually send the email, you can open a TCP socket to port number 25 of your mail server and send the following commands:
HELO yourdomain.com
MAIL FROM: youremail#yourdomain.com
RCPT TO: recipient#recipientdomain.com
Make sure you check all server responses after each command issued. If you don't see any errors until that point, then probably you will be able to send emails with that SMTP server.
And, as Jordan Stewart kindly appointed:
You'll also want to make sure that the
HELO domain has a complementary A /
PTR dns record pair, with the IP
address the domain is mapped to being
the IP address you're connecting from.
The domain also needs at least one MX
record. I.e. if the server you're
connecting from is 123.45.67.89 then
you'd need an A record mapping
yourdomain.com to 123.45.67.89 and a
PTR ("reverse DNS") record mapping
123.45.67.89 back to yourdomain.com. If any of these conditions aren't met
you'll run into problems with some
mail servers as checks for these
things are anti-spam measures.

Categories