0

So a company I am helping out has outlook for their mail. Unfortunately, outlook seems to be very inflexible on how I can set up emails. I have added multiple domains to the outlook admin center for our multiple different sites. However, it will not let me create anything useful with the new domains.

For instance, we have "information@ourMainDomain.com" set up as an account. I tried to create an alias on this account for "information@aSecondaryDomain.com" but then outlook gives me an error saying "information@ourMainDomain.com" already exists. Evidently you cannot use the same username even with different domains.

Fine. So i tried to create a shared mailbox - same issue. information@aSecondaryDomain.com is not allowed, because information@ourMainDomain.com exists... getting frustrating now!

So, after experimenting, trying everything, and spending 2 hours on the phone with outlook support that got me no where, i opted for my own route:

I created a Distribution Group called information@aSecondaryDomain.com, told this that senders outside the organization can send to it, added all the people that need to be involved, and gave them all send access.

This allows us to send emails as info@aSecondaryDomain.com It allows us to recieve them here as well. Also, i can send from outside the organization, ie from my gmail i can send to this account and it comes through, Great!

The problem is when i use php for a contact form, it WILL NOT send to the distribution group. It is not going to junk that i can see, and mail trace doesnt show it ever coming in at all. If i change the send to address of mail function to one of our main emails with the organization it comes through. If i change it to send to my gmail it comes through. As soon as i set it to the address of the distribution group, it will not come through. I see no errors on the php, it thinks it sent... but it never does.

Does anyone have an ideas? Or has anyone done this before?

The code in question is very simple...

<?
$name  = $_REQUEST["name"];
$email = $_REQUEST["email"];
$subject   = $_REQUEST["subject"];
$msg   = $_REQUEST["msg"];
$to    = "information@aSecondaryDomain.org";
if (isset($email) && isset($name) && isset($msg)) {
    $email_subject = "$name sent you a message"; 
        $headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: ".$name." <".$to.">\r\n"."Reply-To: ".$to."\r\n" ;
$msg     = "From: $name<br/> Email: $email <br/> Subject: $subject <br/> Message: $msg";

   $mail =  mail($to, $email_subject, $msg, $headers);
  if($mail)
    {
        echo 'success';
    }

else
    {
        echo 'failed';
    }
}

?>

EDIT: I have no tried PHPMailer... same reuslt - it will send to my regular work address, and my personal, but not to the distribution group.

pjs
  • 18,696
  • 4
  • 27
  • 56
aescript
  • 1,775
  • 4
  • 20
  • 30
  • It's not the code. Something outside the code is preventing it from being received. – John Conde Jan 24 '20 at 22:23
  • This is know, that's why I mentioned that it works fine to other aliases and appears to be an issue with distribution groups. I'm asking if anyone knows how to get this working from any direction, wether it's different code or adjusting something in outlook – aescript Jan 24 '20 at 22:25
  • Maybe spam settings? `if (isset($email) && isset($name) && isset($msg)) {` can be simplified to `if (isset($email, $name, $msg)) {` – user3783243 Jan 24 '20 at 22:26
  • It's not spam - as mentioned I've checked the mail trace in outlook - if the mail ever even arrived to get sorted to spam or anywhere else it would show here - but it doesn't show at all. And I'm not sure how to debug it as normally id run some mail tools on the headers of the sent message but I don't have that with sending it via mail() (unless there's a way to get it that someone knows about) – aescript Jan 24 '20 at 22:32
  • have you tried using something like PhpMailer and sending via SMTP directly instead? – ADyson Jan 24 '20 at 22:34
  • P.S. if you are looking for general guidance / ideas on why email doesn't get sent or doesn't arrive (these are two different problems!) then see this: https://stackoverflow.com/a/24644450/5947043 – ADyson Jan 24 '20 at 22:36
  • I have not tried using phpmailer I'll try and find some information on this – aescript Jan 24 '20 at 22:38
  • It's never a code issue. More likely an Exchange woe. See [Get-DistributionGroup](https://learn.microsoft.com/en-us/powershell/module/exchange/users-and-groups/get-distributiongroup?view=exchange-ps) at the very least, scourge the logs, and then perhaps take it to ServerFault. – mario Jan 24 '20 at 23:36
  • Just want to point out that you've referenced both `information@aSecondaryDomain.com` and `info@aSecondaryDomain.com` in your question. Any chance at all that you've set up one but are trying to send to the other? – Greg Schmidt Jan 25 '20 at 00:11
  • Nah just a mishap in my typing. The addresses are correct in code. – aescript Jan 25 '20 at 00:13

0 Answers0