27

I m trying to send email with following configuration

  • Host: smtp.office365.com
  • port: 587
  • user: myemail@example.com
  • pass: "mypassword"

I'm getting the following exception:

550 5.7.1 Client does not have permissions to send as this sender

I have gone through many forums that told me to set send as permission for the mailbox but I m not able to find any such configuration in Outlook web app, or do I need to configure it somewhere else and if it so then where? I have only used above configuration for sending mails and have not done any config with outlook web app. What all I need to change and configure in my outlook web app?

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
roanjain
  • 1,252
  • 4
  • 14
  • 32

5 Answers5

60

Beware that this error might also occur when the from email does not match the username.

So, be sure to test the value myemail@example.com is the same on user and from.

If it works when both fields have the same value and doesn't work when the from is different from the user, it means you should contact the company responsible for the email server and ask them to create a shared account and add SendAs priviledges for the account.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Luís Cruz
  • 14,780
  • 16
  • 68
  • 100
  • 2
    This was the issue with me. – Ibrahim Azhar Armar Dec 04 '17 at 14:57
  • thanks lot it's work for me @So, be sure to test the value myemail@domain.com is the same on user and from. – chozha rajan Dec 06 '17 at 11:45
  • This works. I was not providing To and From properly. – Pranav Nandan Apr 18 '18 at 11:33
  • Your answer helped me. I had the same case of different "from" and "user" parameter. +1 – Sohel Pathan Jul 06 '18 at 07:22
  • I do not know why this must be set to match - as from fields are simply that and have nothing to do with the authenticated user. If you can authenticate - who cares what name is in the from field. I know not your issue just my rant. If I want to spam with the authenticated user ok , if I want to with 50 million other names same difference - I have access and can send emails. The authenticated user is what should count! – Ken Jul 24 '20 at 19:19
6

go the the Exchange management console and select the user. Right Click, go to the send as permissions option.. check that User NT AUTHORITY\SELF is listed. If not add it.

  • I also have this issue, although not with office365, but would this approach work on a wider issue of sending from a mailserver address? – Martin Mar 18 '15 at 20:11
3

Answer provided by Luis Cruz is the right one.. However, I will try to be more descriptive though,

We were trying to send mail in Mantis Bug Tracker through Office 365 account and were facing the same issue. Below was the config,

$g_enable_email_notification = ON;
$g_phpMailer_method          = PHPMAILER_METHOD_SMTP;
$g_smtp_host                 = 'smtp.office365.com';
$g_smtp_username             = 'abc@example.com';
$g_smtp_password             = '****';
$g_smtp_connection_mode      = 'tls';
$g_smtp_port                 = 587;

Clearly what we were missing was the 'from' property. Adding following properties resolved the issue,

$g_from_name               = 'Mantis Admin';
$g_from_email              = 'abc@example.com';
$g_return_path_email       = 'abc@example.com';
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Gaurang Patel
  • 4,310
  • 6
  • 27
  • 32
1

There can be many reason for this issue, One of this is which is most frequently comes because

Login name and From address is not same.

Login = 'abc@gmailcom' FROM = 'abc@gmailcom'

Now use these variables, It will work.

0

In Exchange PowerShell, add the Send As permission so that Domain\jsmith can send as myemail@example.com (example):

Add-ADPermission "myemail@example.com" -User "Domain\jsmith" -Extendedrights "Send As"
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
KERR
  • 1,312
  • 18
  • 13