JavaMail Hotmail setFlag not working - jakarta-mail

Also, do you know if setting flags is possible in hotmail via javamail? I cannot get the following to work:
//...create connection to hotmail
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);
Message messages[] = folder.getMessages();
messages[0].setFlag(Flags.Flag.SEEN, true); //this doesn't work
folder.close(true);
store.close();
No error is thrown, but the message still appears unread in my hotmail inbox.

You really need to read the javadocs for the com.sun.mail.pop3 package. The POP3 protocol doesn't support the things you're trying to do.

Related

DNN 8 users cannot reset their password

I have a DNN 8.0.1 website
The users are not able to reset their own passwords. There is an error generated when the reset email is sent:
Mailbox unavailable. The server response was: 5.7.0 Mail relay denied
[...]. Invalid credentials for relay for
Emails are sent through an SMTP relay handled by G-Suite.
here is the stack trace:
at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at DotNetNuke.Services.Mail.Mail.SendMailInternal(MailMessage mailMessage, String subject, String body, MailPriority priority, MailFormat bodyFormat, Encoding bodyEncoding, IEnumerable`1 attachments, String smtpServer, String smtpAuthentication, String smtpUsername, String smtpPassword, Boolean smtpEnableSSL)
I have tested the SMTP settings at both the Host and Site Admin levels and they both work.
Email generated from other services are working and emails generated from custom modules are working. Just the emails being set for password resets are not working.
Does anyone have an idea as to why this is happening?
Thanks
When you send an email using the SMTP test, are you sending to an address in the domain of the server? That should work because it doesn't involve a relay.
For relaying, it is the To email address that counts. Relaying means that you are sending to an address that is outside of the domain of the website. So, you need to have permission to do that.
Are your users possible at external email addresses?
One other thing to look at is the SMTP setup for both Host and Site. If I'm remembering right, DNN8 lets you set up separate SMTP for the Host and the site. You may want to check these.
Finally, the way to really see what is going on is to see what is sent to the SMTP server. If you can get at, or have someone get at, the SMTP logs, you'll see exactly how you are sending and the exact error. Given that you are using G-Suite, this may not be easy.
You may get more information from the log4net logs. If there is nothing useful there, you might want to (temporarily) adjust the logging level.
Are you able to get a password reset message for your account?

DNN 7 - SMTP stopped working

I configured the SMTP setting om my DNN 7 siteand everything worked fine for weeks. I tried to send a newsletter today and discovered that there is a problem with the SMTP (even though i have changed nothing). I checked the configuration and verified that it hasn't been changed. And indeed it hasn't. I tried a few email accounts that i have and received the same error time and time again. Here is the error:
There has been an error trying to send the test email. The error is:
There is a problem with the configuration of your SMTP Server. Mail was not sent.
Any ideas?
Well, I checked the error and it appears that i used all my allowed emails out by the email server. I guess this is one of the first thing i should have checked...I suggest you to do that if it ever happens to you :)

Reading mails using JavaMail

This question is more about the behavior. I have been using both POP3 and IMAP to access mails in Gmail using JavaMail API. I noticed something and I wanted to clarify my doubts regarding the same.
I am currently retrieving unseen mails from my Inbox. There were a couple of unread mails and I retrieved them using POP3. I switched over to IMAP and read the same inbox and I was able to retrieve the same 2 mails.
I've been recently using JavaMail and I encountered this kind of behavior and I wanted to know if this is the expected behavior?
You read your mail, did not delete or change anything, so when you read it again it was still there and unchanged. That's all.

cake php email helper - internal error

I am trying to send email with cake php email component:
var $components = array('Email');
$email = new CakeEmail();
$email->from(array('me#example.com' => 'My Site'));
$email->to('xxx#gmail.com');
$email->subject('About');
$email->send('My message');
And I always get message: Couldnt send email. Internal error occured.
In error log there is "SocketException".
I am using cakephp 2.0.
How should I configure things to get it work? I don't want to use any smtp servers and so on, I just want to send simple email.
I am using WAMP on my PC.
Uncomment the line: extension=php_openssl.dll in php.ini. This will resolve your Socket problem.
One more thing I want to say is :
You are mixing two thing core library & component both. FYI
EmailComponent is now deprecated. so use core library instead.
for more details check this link http://book.cakephp.org/2.0/en/core-utility-libraries/email.html
Debug the exception.
I bet that you can't open a connection to your mail server. Looks more like it's an error with your mail server setup or the connection to it than with CakePHp.
For an easy mail server setup for windows I recommend you to use XAMPP, it comes with the preconfigured mail server Pegasus, works just easy and fast for me.
This really does look like it's an error with your mail server setup or the connection to it. However, you are confusing the CakeEmail class for the EmailComponent.
Firstly you're not trying to send a email with the emailComponent, you are using the new CakeMail class (new from 2.x).
Thus, this:
var $components = array('Email');
and this:
$email = new CakeEmail();
are two different things. The first loads the EmailComponent, but you're not using it at all. The EmailComponent as of 2.x is deprecated. In your example you're using the CakeEmail Class.
Firstly you should insure that the class is actually loaded:
App::uses('CakeEmail', 'Network/Email');
Then check if you have the configuration file in:
App/Config/email.php
I suppose you're currently using the default configuration option. This means that the default transport is 'Mail' - the PHP mail function. I suppose you're getting a SocketException, because it can't connect to a underlying mail transport agent and because it is trying to do so over a System Socket... (Which I do not think exists in Windows, but I could be wrong. I know for sure that there is something like that in the windows API for inter-process cominucation)
Anyway, using the default email configuration is ok. Read the CakePHP Book's Section on the CakeEmail class.

smtp sends headers as content

I'm using remote smtp server(from my host company) and send
email from local computer.(google app development server)
But instead of getting nice emails
i get emails that contain headers as if it ware content of email
What can do to change it?
My guess is that you have a newline (\r\n or Carriage Return -Line Feed) in your subject. And, your mailing program doesn't strip newlines in the subject.
If you put a newline in the subject, and your app doesn't remove it, you just moved all following headers down to the body.
Send the email according to the SMTP RFC: https://www.rfc-editor.org/rfc/rfc5321
Getting the headers in the content sounds like you sent them twice or did separate the headers from the content in a way your mail client does not understand.
Check you don't have something wrapping what you send in another layer of email.
Perhaps look at the current (real/outer) headers to see if that gives any clues.
Can you show us your code, please? You don't say which App Engine runtime you're using; I'll assume Python. The App Engine mail API doesn't let you directly set message headers. There's a list of attributes you can set here.

Resources