While trying to READ the email addressee of an email coming from Outlook:
message.getRecipients(Message.RecipientType.TO)
I am getting following exception:
Caused by: javax.mail.internet.AddressException: Domain contains illegal character in string ``'xxxxx#yyyyyy.com'''
at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1269)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:1091)
at javax.mail.internet.InternetAddress.parseHeader(InternetAddress.java:658)
at javax.mail.internet.MimeMessage.getAddressHeader(MimeMessage.java:701)
at javax.mail.internet.MimeMessage.getRecipients(MimeMessage.java:534)
The problem is given by this character " ' " at the beginning and at the end of the email address. The problem is that for the outlook server this is a valid address but not for a MimeMessage, so when I am trying to retrieve it and all the checks are applied I am getting the exception.
Please note that I am not creating the message, I am just reading whatever is in the outlook inbox folder through:
Folder inbox = store.getFolder(.......);
messages = inbox.getMessages();
Any idea how to solve/workaround this?
Thank you very much
Sam
I suspect you are using java mail version higher than 1.4 which by defaults enables strict RFC822 syntax
You could able to read email with quotes by disabling "strict" policy on InternetAddress something like this.
Properties props = new Properties();
props.setProperty("mail.mime.address.strict", "false");
Session session = Session.getDefaultInstance(props, ....);
Or simply
new InternetAddress("...", false);
Related
I have created a VB6 application which contains a service to basically send and receive emails,the service uses a service account and mapi profile configured in Windows 2003 serverR2.
This was working when both exchange server and domain account were in the same network. Once the exchange server got changed the service is unable to send or receive emails giving error
Microsoft Exchange is not available. Either there are network problems or the Exchange computer is down for maintenance. [Microsoft Exchange Information Store - [MAPI_E_FAILONEPROVIDER(8004011D)]], Collaboration Data Objects.
I have searched this error but I wasn't able to gather all as the explanation is for same network.
Anyone could you please advice what can I do to resolve this ?
Thanks,
MAPI has been discontinued by Microsift as suggested by #bob77 also.
I would recommend to use SMTP or EWS.
That being said if you still want to go with it.
Please find the working code below:
Set objMAPI = New MAPI.Session
objMAPI.Logon ShowDialog:=False, NewSession:=False, ProfileInfo:=gobjINI.gstrExchangeServer & vbLf & gobjINI.gstrProfile
'Add a new mesage to the OUtbo Messages Collection
Set objMSG = objMAPI.Outbox.Messages.Add
Set fsoMy_File_Sys_Obj = New FileSystemObject
'Add the recipient list specified in INI File
'Check if this is a multiple Recipient List (names or groups seperated by semicolons!)
If InStr(1, Recipients, ";") Then
objMSG.Recipients.AddMultiple Recipients, CdoTo
objMSG.Recipients.Resolve
Else
'This section is for handling of single recipient name
'Be aware that this may be an email group list name !
Set objRecipients = objMSG.Recipients.Add(Recipients)
objRecipients.Resolve
End If
'Add an attachment if needed
If Attachment_Name <> "" Then
bolAttach_File_Exists = fsoMy_File_Sys_Obj.FileExists(Attachment_Path)
If bolAttach_File_Exists = True Then
'Open the attachment file and add it to the message text
Set tsAttachment = fsoMy_File_Sys_Obj.OpenTextFile(Attachment_Path)
Do While Not tsAttachment.AtEndOfStream
strAttachment_Read = tsAttachment.ReadLine
Message = Message & strAttachment_Read & vbCrLf
Loop
tsAttachment.Close
Else
gobjMAPI.MailSend gobjINI.gstrMailRecipients, "Email Send - Attachment Addition", "Attempted To Attach A File That Does Not Exist", "", ""
End If
End If
'Add Subject Line, Message Content and Send Message
objMSG.Subject = Subject
objMSG.Text = Message
objMSG.Importance = mapiHigh
'The Update method adds all our assignments to collecttion
objMSG.Update
'Now let's actually send the message
objMSG.Send
'End MAPI Session
objMAPI.Logoff
Set objMAPI = Nothing
We are using the TropoSharp to send SMS message to my phone. The weird part is that I didn't get any SMS message, rather I get a phone call and it is very short and I could not figure out what the person is talking over the phone.
By looking at the code, we could not figure out what's wrong:
string voiceToken = "xxx";
string messagingToken = "xxx";
IDictionary<string, string> parameters = new Dictionary<String, String>();
parameters.Add("sendToNumber", "xxx");
parameters.Add("sendFromNumber", "+1 201-xxx-04xx");
string channel = Channel.Text;
parameters.Add("channel", channel);
string network = Network.SMS;
parameters.Add("network", network);
parameters.Add("msg", HttpUtility.UrlEncode("This is a test message from C#."));
Tropo tropo = new Tropo();
XmlDocument doc = new XmlDocument();
string token = channel == Channel.Text ? messagingToken : voiceToken;
doc.Load(tropo.CreateSession(token, parameters));
Console.WriteLine("Result: " + doc.SelectSingleNode("session/success").InnerText.ToUpper());
Console.WriteLine("Token: " + doc.SelectSingleNode("session/token").InnerText);
Console.ReadKey();
Here is the http request (removed some sensitive information)
GET http://api.tropo.com/1.0/sessions?action=create&token=xxxxx&sendToNumber=xxx&sendFromNumber=+1%20201-xxx-xxxx&channel=TEXT&network=SMS&msg=This+is+a+test+message+from+C%23.& HTTP/1.1
Host: api.tropo.com
Connection: Keep-Alive
here is the response (I guess it only means that request is submitted successful):
<session><success>true</success><token>xxxx</token><id>5c994e73ab85ff47fd1af4ffd4002e00
Any idea where we did wrong here? Thanks
You're using the scripting approach, not WebAPI, right? Can you post the script that your application is using? It's my understanding that when you create a session, you're just passing variables up to your script. Your script might be completely ignoring those variables, and just making a voice call.
I agree about your last point. That response just tells you that it succeeded in creating the session. It doesn't return any additional information about other steps of the process.
There are two tokens for your application, one for voice and one for messaging. Are you using the one for messaging? Also, outbound messaging is not turned on be default for your application. You have to contact Tropo support to turn it on for development. They may require you to put some money in your account to do this, but they will not charge you unless you start abusing this feature during development.
I'm trying to send a message to a queue using a Message object and am getting the error
The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted.
Here is the code.
Order ord = new Order(new Guid(), "Smith & Smith");
Message orderMessage = new Message(ord);
orderMessage.UseEncryption = true;
orderMessage.EncryptionAlgorithm = EncryptionAlgorithm.Rc2;
orderMessage.Recoverable = true;
orderMessage.Priority = MessagePriority.VeryHigh;
orderMessage.TimeToBeReceived = TimeSpan.FromHours(1);
orderMessage.UseJournalQueue = true;
orderMessage.Body = "Test Encryption";
queue.Send(orderMessage, "Encrypted Order");
Any help with this is appreciated.
Tom
Did you ever solve this? I came across this problem myself and found out I needed to use (just like the error says) a different format name.
The strange thing was that if I set UseAuthentication property using the MQ certificate, then it worked. But if I also wanted to set UseEncryption, then it did not work.
You do not specify your queue/server setup/formats, but I suspect you're trying to send from one machine to another machine's public queue within the same domain, using DIRECT formatname? As the MQ Manager will use the domain AD to lookup the certificate and queue details, it raises an exception as the format name is invalid (not the same as specified in the AD). So instead of using the direct format, use the queue ID to define the formatname. I switched this:
"FormatName:Direct=TCP:111.222.1.22\your_public_queue"
with this:
"FormatName:PUBLIC=7EB2A53C-7593-462C-A568-5A0EFA26D91D"
Now it worked. You can find your queue ID by right-clicking your queue on the receiver machine and then go to Properties->General and see the value specified in field "ID".
I have found that getting the FormatName correct whether public or private in nature will save hours of work. It's incredibly important to understand the setup of each (Public requiring AD and private does not when access remotely). This is a great summary of FormatName.
https://blogs.msdn.microsoft.com/johnbreakwell/2009/02/26/difference-between-path-name-and-format-name-when-accessing-msmq-queues/
One note on this issue, if your queue format name starts this way: "FormatName:Direct=" then you will receive the error "The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted" if you try to access the queue's QueueName property. Use the queue's FormatName property instead.
MailAddress Sender = new MailAddress("SomeOne#yahoo.com", "SomeOne", Encoding.UTF8);
SmtpClient Client = new SmtpClient("smtp.mail.yahoo.com",465);
Client.Credentials = new System.Net.NetworkCredential(Sender.Address,"Password",Domain??? );
just out of curiosity what is the third overload of NetworkCredential
I mean what we need to pass argument for Domain property . I searched on net but but no one used it(domain property) .I tried "Yahoo.com","#Yahoo.com","Yahoo" bot no every time same authentication error .It can be done without Domain property but where can we use it or what we can pass it .
The Domain property is used for NTLM authentication with Active Directory domains.
It is not used for normal login scenarios.
I am using Peoplecode which is a Peoplesoft coding language.
I am trying to access JUST the 'message text' from a message catalog.
It pulls the correct number 7373 when I use the same code on another page.
But in this instance it returns the message
'GetMessageText: No default message. (2012,2012)'.
Here is the code I am using..
&cur_year = Year(%Date);
&MsgNum = MsgGetText(2012, 2012, "");
It's because it can't find the message (2012,2012). You have to specify the correct message set and message number to retrieve from the message catalog.
Look here:
http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tpcl/book.htm?File=tpcl/htm/tpcl02.htm%2337ee99c9453fb39_ef90c_10c791ddc07__3cd3