Hosting & Domaining Forum

Domain Marketplace => Domain Names => Topic started by: SerenMckay on Feb 01, 2023, 04:24 AM

Title: Mail function gets into spam
Post by: SerenMckay on Feb 01, 2023, 04:24 AM
The following code snippet incorporates the standard email sending function, with the parameters and message that have been specified. The mail-tester has been used to verify that no spam is being sent out from the email server. However, there are still errors being reported even though the sender's email address has been registered in the code. The SPF error message indicates that the server IP address is not authorized to use the sender's email address. Similar errors occur when sending emails to other mail servers such as Gmail. Despite having registered an email address, the discrepancies remain.

<?php
$to 
"web-ba89f@mail-tester.com"

$subject "Test mail"

$message "Hello! This is a simple email message."

$from "registration@MYDOMAIN.COM"

$headers "From: Info <registration@MYDOMAIN.COM>\r\n"

mail($to,$subject,$message,$headers); 

echo 
"Mail Sent."

Title: Re: Mail gets into spam
Post by: Seattle on Feb 01, 2023, 05:00 AM
To ensure that PHP uses the correct email address for a website, ISPmanager has a system where you register the webmaster's email address in its settings. This is done by updating the PHP sendmail_path parameter in the Apache configuration files to include the registered email address.
 You can change it to your real email address in the panel. However, since this parameter refers to PHP_INI_SYSTEM, it can only be updated in the system php.ini or in the Apache configuration file. Additionally, you need to remember to configure the SPF, DKIM and DMARC DNS records to authenticate your email messages and prevent them from being marked as spam.
Title: Re: Mail gets into spam
Post by: cyborgdigital on Feb 01, 2023, 05:48 AM
sent from your application, there are two important things to consider. Firstly, it is recommended to use PHPMailer. And secondly, it is important to use certified SMTP servers such as Gmail. By following these two steps, you can ensure that your emails are delivered successfully and do not get marked as spam or junk mail. Additionally, you can also implement best practices such as setting up proper authentication using SPF and DKIM signatures to further increase the authenticity of your emails.
Title: Re: Mail function gets into spam
Post by: Rakesh01 on Aug 21, 2023, 04:24 AM
Here are a few suggestions to help resolve the SPF error and improve email deliverability:

1. SPF Record: Ensure that your DNS settings include a valid Sender Policy Framework (SPF) record for your domain. You need to explicitly authorize the IP address of your email server to send emails on behalf of your domain.

2. Domain Verification: Some email services, like Gmail, require domain verification before accepting emails. Verify your domain ownership and configure any necessary DNS records accordingly.

3. Reverse DNS Lookup: Check if your email server has a valid reverse DNS (PTR) record. Many email servers perform reverse DNS lookup to verify the legitimacy of incoming emails.

4. SMTP Authentication: Instead of using the `mail()` function in PHP, consider using a dedicated email library such as PHPMailer or SwiftMailer. These libraries support SMTP authentication, which can provide better delivery rates.

5. Use SMTP Relay: Instead of sending emails directly from your server, you can use an SMTP relay service provided by your hosting provider or a third-party service. SMTP relay services often have better delivery rates and can help bypass certain restrictions imposed by email providers.

6. Enforce Valid "From" Address: Make sure the "From" address you use in your code is a valid and existing email address associated with your domain.

and:

1. DKIM Signature: Implement DomainKeys Identified Mail (DKIM) to digitally sign outgoing email messages. It provides an additional layer of authentication, ensuring that emails are not tampered with during transit.

2. DMARC Policy: Configure a DMARC (Domain-based Message Authentication, Reporting, and Conformance) policy for your domain. DMARC helps prevent email spoofing and allows you to specify how receiving mail servers should handle emails that don't pass SPF or DKIM authentication.

3. Check IP Reputation: Use online tools to check the reputation of your email server's IP address. If it has a poor reputation, it may be blacklisted by some email providers. Address any issues that might have caused your IP address to be blacklisted.

4. Email Server Configuration: Review your email server configuration to ensure it conforms to industry best practices. Consider enabling features like SSL/TLS encryption, SPF checking, DKIM verification, and SMTP authentication.

5. Monitor Bounce and Feedback Loop Reports: Set up bounce and feedback loop reporting to receive notifications when an email fails to deliver or is marked as spam by recipients. This can help identify issues and take appropriate actions to rectify them.

6. Provide Opt-in and Unsubscribe Options: Always send emails to recipients who have explicitly opted-in to receive them. Include an unsubscribe link in your emails to give recipients an option to opt out. This helps build trust and reduces the chances of your emails being marked as spam.

7. Test Email Deliverability: Use email deliverability testing services or tools to simulate sending emails and identify potential issues. These tests can provide insights into how various email providers perceive your emails and help you make necessary adjustments.