locked
Different Reply to email (Exchange Online API) RRS feed

  • Question

  • I am developing Web application which will be hosted on windows azure.

    I need the emailing functionality, for which i intent to use exchange online. And i am new to exchange online API.
    My application users will send messages to each other. I intent to use Exchange online API for this.

    One of the requirement i have is, though all the message emails sent through my message should go through single id, e.g. member@myapp.com but when the user checks the email in his inbox, when he presses the reply button, the reply email should go to the user@hotmail.com or user@gmail.com whatever the sender user's email id is.

    i.e. all sent messages should go through single email id, but i dont want to get reply messages to this email id, instead it should go to the sender's personal email id. (same as linkedin does)

    Let me know if it is possible with exchange online API and also how far it is customizable. (e.g. if i want to filter all the messages gone through member@myapp.com for user abc. i.e. .listing sent messages for abc. listing incoming messages for abc user.

    Any help would be great. This is urgent.

    Meenxip

    Monday, September 19, 2011 10:54 AM

Answers

  • >>message.OutgoingEmailid = Member@myapp.com (This is myapp's email id) (I imagine that outgoingEmailid property exists)

    No there is Sender,From and Reply to properties you can set on a message but what mailbox your code will send a message from depends on your code what you want to do is possible but you seem to be asking for API functionality to suit your problem rather the coding your logic to solve your problem. What i suggest you do is start coding yourself to test what actually happens then ask questions around particular pieces of code if they don't work. What happens at the destination end can vary on the Message platform at the destination eg what you may see internally vs hotmail vs Gmail vs Yahoo can completely vary because these are all different platforms. You have to work within standard functionality so in generally if you can do it in a Mail client like Outlook etc you can duplicate this functionality in code. But the best way to find out is start coding and testing.

    Cheers
    Glen

    • Marked as answer by meenxip Friday, September 23, 2011 9:26 AM
    Thursday, September 22, 2011 5:21 AM

All replies

  • When you refer to the Exchange online API there no such thing with Exchange Online this is just hosted Exchange 2010 so any OnPremise API's such as MAPI and Exchange Web Services is what you would use to access Exchange programatically. As a starting point try the Exchange Managed API http://msdn.microsoft.com/en-us/library/dd633710(v=exchg.80).aspx and http://msdn.microsoft.com/en-us/library/gg591267%28v=exchg.140%29.aspx .

    >i.e. all sent messages should go through single email id, but i don't want to get reply messages to this email id, instead it should go to the sender's personal email id. (same as linkedin does)

    This is not a feature of Exchange so it really depends what client your users use eg if they use Outlook or OWA to connect to their mailboxes then all replies will come from their mailboxes Primary address. With Outlook 2010 you can have multiple mailboxes in one profile and the user can choose which mailbox the response is coming from but this is down to the user(unless you create a client side Outlook plugin to control this). If your creating your own client then this is just a feature you would need to build into your code but this would only work if all access was only from this client.

    Cheers
    Glen

     

    Tuesday, September 20, 2011 4:49 AM
  • Thanks Glen,

    I am not sure if i made it clear or not. But my requirement is like, i want email message objects property like Outgoing EmailId, From EmailId and Reply EmailId. I have User1 and User2.

    So that if i set

    message.OutgoingEmailid = Member@myapp.com (This is myapp's email id) (I imagine that outgoingEmailid property exists)

    message.FromEmailId = user1@gmail.com  (this is the email id using which the user has registered to myapp application)

    message.ToEmailId = user2@hotmail.com (this is the email id using which the user has registered to myapp application)

    So when User1 sends message (using my application page) to user2, what should actually happen is email should go to user2@hotmail.com using Member@myapp.com email Id on behalf of user1@gmail.com.  

    When User2 goes to http://hotmail.com and checks emails then he should get message with details like "User2 via MyApp" to "User2"

    and when User2 Reples the email, then the email should go to user2@hotmail.com from user1@gmail.com even though the email actully came from member@myapp.com

    Let me know if this is possible? and do we have something like OutgoingEmailId?

    Thanks

    Meenxip

    Wednesday, September 21, 2011 8:28 AM
  • >>message.OutgoingEmailid = Member@myapp.com (This is myapp's email id) (I imagine that outgoingEmailid property exists)

    No there is Sender,From and Reply to properties you can set on a message but what mailbox your code will send a message from depends on your code what you want to do is possible but you seem to be asking for API functionality to suit your problem rather the coding your logic to solve your problem. What i suggest you do is start coding yourself to test what actually happens then ask questions around particular pieces of code if they don't work. What happens at the destination end can vary on the Message platform at the destination eg what you may see internally vs hotmail vs Gmail vs Yahoo can completely vary because these are all different platforms. You have to work within standard functionality so in generally if you can do it in a Mail client like Outlook etc you can duplicate this functionality in code. But the best way to find out is start coding and testing.

    Cheers
    Glen

    • Marked as answer by meenxip Friday, September 23, 2011 9:26 AM
    Thursday, September 22, 2011 5:21 AM
  • Hi Glen,

    I have tried coding.

    Now i get this error message

    "The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account."

    Can you help me out in this?

    What if i have thousands of users Whoes email addresses are not of my organization (foreign email addresses)?

    Thanks

    Meenxip

    Saturday, September 24, 2011 8:52 AM
  • That error means that the user that is being used to send the mail doesn't have rights to send on behalf of the user whom the email address belong to which means to send as another user you need either Send on behalf or SendAs rights to that account see http://www.shudnow.net/2007/08/12/send-on-behalf-and-send-as/ which describes both with Exchange-Online you need to grant rights via Remote Powershell http://help.outlook.com/en-us/140/cc952755.aspx

    >> What if i have thousands of users Whoes email addresses are not of my organization (foreign email addresses)?

    In generally you should never be sending email from addresses that you don't own because you will be spoofing which could lead to your servers being blacklisted. Exchange won't allow you via any of the mailbox API's such as EWS to send email from addresses that aren't legitimate or defined as being owned by the Exchange organization where the message is being sent from and where the user sending the email doesn't have rights to do so (eg Send on Behalf or SendAs). Exchange-Online especially would never allow you do this because at the end of the day they don't want to have their servers blacklisted.

    The only way you would be able to do this even if you have a legitimate and legal reason to do so would be to setup you own SMTP servers and allow your application to relay through these. (You still need to content with the issue with doing this such a SPF, Anti-spam etc,etc)

    Cheers
    Glen

    Monday, September 26, 2011 4:46 AM
  • Thanks for the information.

    Let me know what you think, how linkedin must has accomplish this task. What you think they must have setup their own SMTP server?

    Tuesday, September 27, 2011 6:27 AM
  • >Let me know what you think, how linkedin must has accomplish this task. What you think they must have setup their own SMTP server?

    Yes LinkedIn would have a very complex probably highly customized and developed mail system (massive redundant farm of servers) to do what they do with Groups and membership etc. They would also have a team of developers to build it (its a $9 billion dollar company) I would say its safe to assume they don't use Exchange however from what i know they do have Oultook plugin etc to pull and push contact data etc between different systems.

    Cheers
    Glen

    Tuesday, September 27, 2011 6:53 AM
  • Hello Gen.

    If i would use from emailid from my domain only, can i have the wording like "Abc Xyz via myapplication.com" same as linkedin does?

    I have set from.name property, but it does not show what i set in from.name property.

    Any idea?

    Thanks

     

    Tuesday, October 4, 2011 12:05 PM
  • With EWS as a general rule no you can try to set the displayName but it will always in general be resolved back to whatever is set in the GAL by the resolution processes described in http://technet.microsoft.com/en-us/library/bb430743.aspx which on Exchange Online you won't be able to control (on Prem you can use simple displayname etc via http://blogs.technet.com/b/bobh/archive/2010/03/31/using-the-simple-display-name-as-an-external-display-name.aspx). If your using a SMTP relay then you can do what you like with OnPremise you could also use Transport Agents to implement a custom solution to make changes to outgoing messages so messages sent externally could reflect this (internal would still resolve back).

    Cheers
    Glen

    Wednesday, October 5, 2011 2:27 AM