none
Delivery has failed to these recipients or groups: RRS feed

  • Question

  • Hi all

      This my application to send mail to receipent, i am getting the below erro

     " You can't send a message on behalf of this user unless you have permission to do so. Please make sure you're sending on behalf of the correct sender, or request the necessary permission. If the problem continues, please contact your helpdesk"

    here i my code snippet

     Microsoft.Office.Interop.Outlook.Application OutlookIns = new Microsoft.Office.Interop.Outlook.Application();
                NameSpace olNamespace = OutlookIns.GetNamespace("MAPI");
                 
    
                MAPIFolder myInbox = olNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
              
    
                Items item = myInbox.Items;
    
                foreach (MailItem mail in item.OfType<MailItem>())
                {
                    if (mail.UnRead == true)
                    {
                         subject = mail.Subject;
                        //Console.WriteLine(subject);
    
                         DiscountAvalibilityCheck(subject);
                         mail.HTMLBody = GenerateReport(t);
                         mail.Send();
                    }
                }

    how to overcome the issue, please help me.


    Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.

    • Moved by CoolDadTx Tuesday, October 22, 2013 2:09 PM Office related
    Monday, October 21, 2013 10:44 AM

All replies

  • This is a security setting.  You cannot arbitrarily send email as though you were a different user.  This helps prevent email hacks.  Your code is enumerating through a user's unread emails.  For each one it is trying to send a new email.  That is not going to work.  I'm not even sure what you're trying to do as it looks like you're going to blast out emails to everyone in the inbox which is a clear case of spamming which we cannot support.  If you can clarify exactly what you're trying to do then we might be able to help you otherwise this looks like malicious code.

    Michael Taylor
    http://msmvps.com/blogs/p3net

    Monday, October 21, 2013 2:24 PM
  • HI CoolDadTx

      we have one common mail box like  Discount@company.co.in,Company employee will send mail to the mail ID Discount@company.co.in, once i receive the mail,in subject i am having employee code,once i read the employee code i want to generate one small report and append in the body of mail and i want to reply to the same mail, this is my task.

     please help me,i almost done with this, this mail part is prob for me.can you please help me.


    Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.


    • Edited by miruan Tuesday, October 22, 2013 4:41 AM
    Tuesday, October 22, 2013 4:40 AM
  • Ok, if you want to reply to the original sender then you'll use Reply and not Send.  Reply probably shouldn't give you any error.
    Tuesday, October 22, 2013 2:09 PM