Microsoft 365 ve DMARC Uygulamasıyla Birlikte Exim Posta Teslim Hatalarını Düzeltme
Aynı yapılandırma eski sistemlerde sorunsuz çalışıyor olsa bile, yeni kurulan sunucularda posta teslim sorunları aniden ortaya çıkabilir. Exim ile birlikte Microsoft 365 kullanan cPanel/WHM sunucularda, DMARC uygulaması nedeniyle reddedilen veya doğru biçimde yönlendirilemeyen iletiler yaygın bir senaryodur.
Problem Özeti
Yeni sunucularda giden sistem e-postaları "undeliverable domain" gibi hatalarla veya DMARC reddiyle karşılaşabilir. Bazı durumlarda mesajlar geçici olarak kabul ediliyormuş gibi görünür ama sonradan geri döner. Bu tutarsızlık genellikle Exim'in yanlış yönlendirme yapılandırması ile katı posta kimlik doğrulama politikalarının birleşiminden kaynaklanır.
Belirtiler
- Mesajların yerel olarak teslim edilemediği işaretlenmesi (fail_remote_domains).
- Hedef sunucudan DMARC hataları veya reddetmeler.
- Benzer kurulumlu sunucular arasında farklı davranış.
- Loglarda router decline veya yanlış yönlendirme kararlarının görünmesi.
Asıl Sebep
Sorun genellikle DNS veya Microsoft 365'in kendisi değil, Exim'in yanlış yönlendirme yapılandırmasıdır.
- Smarthost yapılandırması mevcut ama yanlış biçimlendirilmiş.
- Exim yönlendiricileri sözdizimi hataları nedeniyle yönlendirmeyi reddediyor.
- Mesajlar fail_remote_domains'e düşüyor.
- Katı DMARC politikaları hizalı olmayan mesajları reddediyor.
Kritik bir ayrıntı, smarthost rotasının biçimidir. Exim, iki nokta üst üste ile değil boşlukla ayrılmış rota tanımını gerektirir. Küçük bir sözdizimi hatası bütün yönlendirme sistemini bozabilir.
Doğru Yapılandırma
Code:
smarthost_routelist=* domain-name-mail.protection.outlook.com
smarthost_auth_required=0
send_via_smart_host=1
Değişiklikleri Uygulayın
Code:
/scripts/buildeximconf
/scripts/restartsrv_exim
Doğrulama
Code:
exim -bt your@email.com
Beklenen çıktı:
Code:
router = lookuphost
transport = remote_smtp
host = aior-com.mail.protection.outlook.com
Ardından gönderim testi yapın:
Code:
echo "test" | mail -s "test" your@email.com
Başarılı teslim aşağıdaki gibi görünür:
Code:
250 2.6.0 Queued mail for delivery
Completed
Microsoft 365 Entegrasyonu
Kararlı teslim için Microsoft 365'te bir mail flow connector yapılandırın:
- From: Your organization
- To: Office 365
- Authentication: By IP address
Gönderici sunucunun tüm IP adreslerini connector'e ekleyin.
Bu Çözüm Neden Çalışır?
- Tüm giden postaları Microsoft 365 üzerinden zorlar.
- SPF ve DMARC hizalamasını garantiler.
- Sunucu hostname'inden doğrudan teslimi önler.
- Yönlendirme fallback hatalarını ortadan kaldırır.
Fixing Exim Mail Delivery Failures with Microsoft 365 and DMARC Enforcement
Mail delivery issues can suddenly appear on newly deployed servers even when the same configuration worked on older systems. A common scenario involves cPanel/WHM servers using Exim together with Microsoft 365, where messages are rejected due to DMARC enforcement or fail to route correctly.
Problem Overview
On new servers, outgoing system emails may fail with errors such as "undeliverable domain" or DMARC rejection. In some cases, messages appear to be accepted temporarily but later bounce back. This inconsistency is typically caused by incorrect routing configuration in Exim combined with strict mail authentication policies.
Key Symptoms
- Messages marked as undeliverable locally (fail_remote_domains).
- DMARC failures or rejections by the destination server.
- Different behavior between servers with similar setups.
- Logs showing router decline or incorrect routing decisions.
Root Cause
The issue is usually not DNS or Microsoft 365 itself, but incorrect Exim routing configuration.
- Smarthost configuration is present but incorrectly formatted.
- Exim routers decline routing due to syntax errors.
- Messages fall back to fail_remote_domains.
- Strict DMARC policies reject misaligned messages.
One critical detail is the format of the smarthost route. Exim requires a space-separated route definition, not a colon-separated one. A small syntax mistake can cause the entire routing system to fail.
Correct Configuration
Code:
smarthost_routelist=* domain-name-mail.protection.outlook.com
smarthost_auth_required=0
send_via_smart_host=1
Apply Changes
Code:
/scripts/buildeximconf
/scripts/restartsrv_exim
Verification
Code:
exim -bt your@email.com
Expected result:
Code:
router = lookuphost
transport = remote_smtp
host = aior-com.mail.protection.outlook.com
Then test sending:
Code:
echo "test" | mail -s "test" your@email.com
Successful delivery will show:
Code:
250 2.6.0 Queued mail for delivery
Completed
Microsoft 365 Integration
For stable delivery, configure a mail flow connector in Microsoft 365:
- From: Your organization
- To: Office 365
- Authentication: By IP address
Add all sending server IP addresses to the connector.
Why This Fix Works
- Forces all outbound mail through Microsoft 365.
- Ensures SPF and DMARC alignment.
- Prevents direct delivery from server hostnames.
- Eliminates routing fallback errors.