You need to sign in to do that
Don't have an account?
withoutme
test method for email headers in apex email services
How do I specify the name,value for email headers in my test method for inbound email services?
Messaging.InboundEmail.Header[] hd = email.headers[name='Date', value='Tue, 28 Apr 2009 14:08:37 -0700']; THIS GIVES AN ERROR Messaging.InboundEmail.Header[] hd = email.headers; hd[0].name='Date'; hd[0].value='Tue, 28 Apr 2009 14:08:37 -0700']; THIS GIVES SYSTEM.NULLPOINTEREXCEPTION ERROR
Any help will be greatly appreciated
You can use this to test the headers of an inbound email:
Messaging.InboundEmail.Header hditem= new Messaging.InboundEmail.Header(); email.headers=new Messaging.InboundEmail.Header[1]; hditem.name='Date'; hditem.value='Tue, 28 Apr 2009 14:08:37 -0700'; email.headers[0]=hditem;
All Answers
There is a great sample here that should help you LINK
http://wiki.developerforce.com/index.php/Code_Sample_-_Testing_Email_Services_with_Inbound_Attachments
You can use this to test the headers of an inbound email:
Messaging.InboundEmail.Header hditem= new Messaging.InboundEmail.Header(); email.headers=new Messaging.InboundEmail.Header[1]; hditem.name='Date'; hditem.value='Tue, 28 Apr 2009 14:08:37 -0700'; email.headers[0]=hditem;