I follow this doc to enable wso2is to sent email for self user registration :
https://docs.wso2.com/display/IS520/Self+Sign+Up+and+Account+Confirmation
But I am not receiving any email.
I would like to investigate but there is no message in the log althoug I add the following logger in log4j.properties :
log4j.logger.org.apache.axis2.transport.mail=DEBUG
log4j.logger.com.sun.mail=DEBUG
And also put -Dmail.debug=true in server.sh but nothing about smtp error or mail execption shows up in the log...
How can I fix it and investiguate ?
Regards
If you are using a gmail account for sending emails, you have to go to [1] and select "Turn on" option for allowing 3rd party apps to send emails using gmail.
However if that is not the case, you can enable debug logs for following.
log4j.logger.org.wso2.carbon.identity.mgt=DEBUG
and identify the issue based on the logs.
[1] https://www.google.com/settings/security/lesssecureapps
It might even be that a virusscanner blocks the gmail port (587) for spamming.
Using DevNullSmtp.jar helps to see what is going out.
See also
https://www.yenlo.com/blog/wso2easy-errors-sending-otp-emails-in-wso2-identity-server
Related
I've checked with the cfmail tag. But, if we use failto attribute. It doesn't work to me. So, what can I do? Could you please provide an exact answer to me?
There are many variables at play here but we rely on failto to function for a high volume email system so I can confirm it works. The underlying thing that is happening is that it lets you specify the envelope FROM for the message (what the email server sees) separately from the header FROM (what the receiving user sees). Envelope from can be considered like the reply address on a physical envelope and the header FROM like an address on the letter inside the envelope. If failto is not included in the cfmail tag then they are one in the same.
If the failto is being ignored for some reason or a mail server chooses to ignore it then then the header From address (cfmail from attribute) should be getting the bounce.
If the From address is not getting a bounce then your email is likely just not going out. The message has to reach the mail server for the bounce to occur. If ColdFusion is just failing to reach the mail server then mail will end up in the undelivr folder in your CF instance Mail directory. If that is happening then go into your CF admin interface and ensure the mail server can connect. To retry a message you can just move from undelivr to spool directory.
None of the above an issue? Make sure that you can send an email through your mail server to the failto address you are trying to use, otherwise there is no point in putting that address in the failto attribute.
If you're not getting a return email for failures, it's probably because the target email's server isn't set up to return a notification of failed delivery.
See here: https://community.adobe.com/t5/ColdFusion/CFMail-How-do-I-know-if-email-is-bounced/td-p/2001466
My company just turned on sender validation for the SMTP relay. So in the old days, I could send an email to nobody#company.com and it would not result in any error. Now, that email results in this:
"Error","scheduler-2","10/31/16","09:04:49",,
"com.sun.mail.smtp.SMTPSendFailedException:
250 2.0.0 xxxxxxxx-1 Message accepted for delivery ;
nested exception is: com.sun.mail.smtp.SMTPAddressFailedException:
550 5.1.1 User Unknown on Mail Relay"
Is there anything I can do via JVM arguments or anything else to ignore these errors and consider the email sent? There's a box where we send out 2-3K emails a day and there's about 1K of "undelivered" emails now on a daily basis. :(
The exception SMTPAddressFailedException is a result of a failed authentication on the mail server, so this is not related to the JVM configuration at all. ColdFusion simply builds mail content and adds it to the mail spooler. Due to the async. nature of a spooler, you cannot catch these errors at runtime.
Your only option is to communicate with the actual mail server before using cfmail (and ask if the sender is legit). However, as far as I know there is no built-in function/tag/tool in CF to do so.
I have posted this question on the Amazon AWS Forums, but figured I might get a quicker, better answer here. I apologize if you see it twice.
My company uses an Amazon AWS SMTP server to send emails via a Java-based web interface. This is just a small part of our application, intended to allow users to invite other users to our application.
We have discovered on a very few number of occasions that certain email addresses are not receiving the invitations. Initially we thought it was related to hyphens in the email addresses, but now I've determined that this isn't necessarily the case. I have been troubleshooting this for some time using my own email domains, and I have determined that the following two email addresses NEVER receive any emails sent using the AWS SMTP server (email-smtp.us-east-1.amazonaws.com), but there are no errors reported during the sending process -- the emails just never arrive. The second list shows similar email addresses that always DO receive invitations sent using our system. Note that the addresses on the first list NEVER receive emails, I have tried from all of our deployed instances many, many times.
ADDRESSES THAT DO NOT RECEIVE EMAIL:
jeremygoodell#jeremygoodell.com
jeremy-goodell#jeremygoodell.com
ADDRESSES THAT DO RECEIVE EMAIL:
test#jeremygoodell.com
jeremy-goodell#pinkymcberry.com
jeremy-goodell#hotmail.com
jeremygoodelk#jeremygoodell.com
There are very, very few email addresses that end up with this problem. I was somewhat lucky to find two in my own domain that are exhibiting the problem. I have of course verified that this has nothing to do with spam filtering.
The application is written in Java using the play framework. Play uses Apache Commons Email library under the hood. You can read more about this here: http://www.playframework.com/documentation/1.1/emails.
Here are some of the steps I have taken during my troubleshooting efforts:
1) Try with a different SMTP server (using my personal ISP SMTP -- smtp.gvtc.com) -- ALL addresses DO receive emails when I use this SMTP server. This would seem to isolate the problem as being specific to the AWS SMTP server.
2) Set up my own AWS account and use the SMTP settings for this account (after verifying the addresses in question) -- I have the exact same issues using my own AWS SMTP account settings. This would seem to indicate that the problem is not specific to our company's AWS account.
3) Turn on the play email debug setting (mail.debug=true in the configuration file). A great deal of information is shown in the console for each email sent by the system, but there is absolutely no difference between emails sent to good addresses and those sent to bad addresses. There is no indication whatsoever of any errors.
Here is the contents of the log for one of the emails that never arrived. Note that this is using the AWS server I set up for myself. It looks exactly the same when I use our company's AWS SMTP server except that the from email address is different. I have removed the actual email content, since it's in HTML, somewhat confidential, and not relevant to the problem.
May 15, 2013 8:44:47 AM play.Logger info
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems,
Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "email-smtp.us-east-1.amazonaws.com", port 465, isSSL false
220 email-smtp.amazonaws.com ESMTP SimpleEmailService-376766033
DEBUG SMTP: connected to host "email-smtp.us-east-1.amazonaws.com", port: 465
EHLO 0.1.0.5
250-email-smtp.amazonaws.com
250-8BITMIME
250-SIZE 10485760
250-AUTH PLAIN LOGIN
250 Ok
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "SIZE", arg "10485760"
DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN"
DEBUG SMTP: Found extension "Ok", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP: check mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM
AUTH LOGIN
334 VXNlcm5hbWU6
QUtJQUk3WDNURUI0NEVKNlRSU1E=
334 UGFzc3dvcmQ6
QXJwZjl4eU1FTVc1WFNFR3ZxVXVPODNhRjFkcG8xMFpSeURXY0ZsNGVHQXM=
235 Authentication successful.
DEBUG SMTP: use8bit false
MAIL FROM:<jeremy-goodell#hotmail.com>
250 Ok
RCPT TO:<jeremygoodell#jeremygoodell.com>
250 Ok
DEBUG SMTP: Verified Addresses
DEBUG SMTP: "jeremygoodell#jeremygoodell.com" <jeremygoodell#jeremygoodell.com>
DATA
354 End data with <CR><LF>.<CR><LF>
Date: Wed, 15 May 2013 08:44:47 -0500 (CDT)
From: "jeremy-goodell#hotmail.com" <jeremy-goodell#hotmail.com>
Reply-To: "jeremy-goodell#hotmail.com" <jeremy-goodell#hotmail.com>
To: "jeremygoodell#jeremygoodell.com" <jeremygoodell#jeremygoodell.com>
Message-ID: <2322287.7.1368625487826.JavaMail.UGOODJ3#SAOTXWL-9X913M1>
Subject: Please join the ACT Aspire Hari AV test delivery portal
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_6_16196755.1368625487826"
------=_Part_6_16196755.1368625487826
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
>>>> HTML EMAIL BODY REMOVED <<<<
------=_Part_6_16196755.1368625487826--
.
250 Ok 0000013ea86fb2de-0bd70205-8e9a-4042-972f-ad94b28c3101-000000
QUIT
221 Bye
I'm going to follow up here with what turned out to be the solution to the problem. The Amazon AWS SMTP service maintains a "14-Day Suppression List" which is a list of email addresses that have bounced during the last 14 days. Any email sent via the Amazon SMTP service will fail when attempting to send to an address on the Suppression List. Unfortunately, they don't report the error, but instead, send an "Undeliverable" reply to the sender. So, if you have an automating sending service, you'll never know.
I happened to find it because when I set up my own AWS SMTP server, I put in one of my own email addresses as the sender of the automated email. When I logged into that email account, I saw the Undeliverable messages, which explained that the target email is on the Supression List.
Amazon does allow you to log into your Email Service Console and remove email addresses from the Suppression List. You just put in the email address, click Remove, and the address is immediately removed from the list. You have no way to see which email addresses are on the Suppression List, but you can remove any address you want.
So, in the case of my email failures, I believe what happened was that I tried to email to them before the email creation was complete, resulting in a bounce. Once the email address bounces, it goes on the Supression List. For the next 14 days any email sent via ANY AWS SMTP server (not just mine) would fail. After 14 days (apparently) the email address is removed from the Suppression List until the next bounce is encountered.
This Amazon software is very new, they actually just announced this Suppression List service in early May. So they may still need to work out a few kinks. This particular issue seems to present a somewhat serious issue for automated senders like ours. After all bounces do occur on occasion for reasons beyond our control.
I have several instances in my project where I attempt to send an email within a Django view.
I want to be able to hardcode the email sender within the view. When I try to do so, though, it continues to send the emails from the default account specified in my settings file.
Here is an example:
if testform.is_valid():
beta=testform.save()
subject="Hi Beta Tester"
sender="correct#email.com"
recipient=[testform.cleaned_data['email']]
text=loader.get_template('registration/beta_email.txt')
html=loader.get_template('registration/beta_email.html')
site_name='mysite'
d=Context({'site_name':site_name})
text_content=text.render(d)
html_content=html.render(d)
#This sends two mail versions, plain text and html
msg=EmailMultiAlternatives(subject, text_content, sender, recipient)
msg.attach_alternative(html_content, "text/html")
msg.send()
return HttpResponseRedirect('/splash/')
I thought that I could send specify the sender argument explicitly here. And, yet, when I test it, the email is being sent from the address listed in my settings file, configured as the following:
EMAIL_USE_TLS=True
EMAIL_HOST='smtp.gmail.com'
EMAIL_HOST_USER='wrong#email.com'
EMAIL_HOST_PASSWORD='private'
DEFAULT_FROM_EMAIL='wrong#email.com'
Do I just have to remove the DEFAULT_FROM_EMAIL constant to make it work? I tried doing so and it seems to be working but I'm confused. In the Django documentation, it suggests that setting sender in the view should override the DEFAULT.
I've finally figured out the issue here. Unfortunately, gmail rewrites the from and the
envelope on authenticated smtp.
If you want to get around that, you have to use a third party mail server (which doesn't act like such a prissy) and then send mail to gmail users.
For the sender e-mail try putting it in < > and you can add a name:
sender = "Formal Name <correct#email.com>"
that is exactly the syntax I have in my e-mail sending view and it works.
There really shouldn't be a reason that adding the name to it would change how it's sending, but it may be worth trying and perhaps you want an easily readable name anyway.
I can't believe I've never noticed this before, but it seems that CFMail won't send to an email address that isn't explicitly set up on the destination mailserver.
This means that if I'm using 'info#somedomainorother.com' and have that set up to catch all email on the domain, CFMail won't send to 'test#somedomainorother.com'.
This causes a massive amount of problems for me, as I'm using CFMail to send out order confirmations, member activations and all manner of other bits and pieces.
Whatever your views on using catchall addresses, it can't be denied that people do use them So, in any case that a user enters a made-up address into one of my sites, they won't receive their email.
There must, simply MUST be a way around this - can anyone help?
For refernece, the message that appears in the logs when sending to a catchall address is 'Invalid Addresses'.
EDIT: Here's the CFMail syntax I'm using -
<cfmail to="#Arguments.sEmailAddress#" from="#Application.sAppEmailAddress#" subject="Stock reminder confirmation: #Local.qGetProductDetails.sProductName# - #Application.sCompanyName#" type="HTML" server="#Application.sAppEmailServer#" username="#Application.sAppEmailAddress#" password="#Application.sAppEmailPassword#">
Translates into:
<cfmail to="thisisatest#somedomainorother.com" from="application#mydomainname.com" subject="Stock reminder confirmation: Some product - My Company" type="HTML" server="mail.mydomainname.com" username="application#mydomainname.com" password="XXXXXX">
All works fine for info#somedomainorother.com but not for randombunchofcharacters#somedomainorother.com.
Important to note of course, that the catch-all is working correctly in all other respects, test emails from mail clients work perfectly.
Its not ColdFusion that cares about email validity, its the SMTP server. CF only cares about well formed email addresses.
If you initiated a telnet session to your mail server and tried to use the same address, I'm sure it would have the same result.
Debugging tips for SMTP Connectivity:
http://www.talkingtree.com/blog/index.cfm/2004/11/22/debug-smtp
Can I see your CFMAIL tag setup? CFMAIL doesn't care as long as the email address is properly formatted.
Urgh!
Turns out it was an issue with the server. For some reason, catchall email accounts serverwide had stopped working properly. After an email to my hosting provider, it's all working fine with no code changes.
They're somewhat cagey as to what caused the issue, and I was still able to use an email client to send mail out to the addresses...
Thanks for the help in any case. ;)