Error 542, You are not allowed to send your message when sending mail

Procédure

Why does this error occur?

This error occurs when the e-mail address entered in your code is not authorised to send e-mails from the SMTP server.

How can I fix this problem?

To send an email in PHP, via a form, you need to use the following code:

$to = "test@test.com"; $from = "test@votredomaine.com"; $entete = "MIME-Version: 1.0"; $entete .= "Content-type: text/html; charset=iso-8859-1\r\n"; $entete .= "From: $from <  $from  >\r\n"; $entete .= "Reply-to: $from\r\n"; $entete .= "X-Mailer: PHP\r\n"; $entete .= "X-Priority: 1\r\n"; $entete .= "Return-Path: <  $from  > \r\n"; $msg = "test\r\n"; $sujet = "*** Test Mail ***\r\n"; $res = (mail($to,$sujet,$msg,$entete)); if (true === $res) { $texte = "Mail sent to"".$to."\"\n"; printf (nl2br("$texte")); } else { $texte = "**** ERROR : PROBLEM SENDING MAIL ! ****"; printf (nl2br("$text")); } 

1. On shared hosting, the sender address ($from in the code) must be the one attached to your domain. The address must also be different from that of the recipient, otherwise you will see the error message 542( You are not allowed) appear and your email will not be sent.

2. If you wish to use a sender address other than the one attached to your domain, you will need to subscribe to a virtual server. We invite you to discover our offers from this link: VPS server (from €9.99/month excluding VAT) .

help.lws.net/a/809
Was this article helpful?

Yes

No

Read 21 355 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

Questions about the article (1)

Ask a question
JFB
31 juil. 2023
Nous sommes lundi 31 juillet, il est 15 heures. Depuis vendredi vers environ 14 heures, sur plusieurs sites chez LWS, la connexion FTP est très lente voire impossible et quand toutefois elle aboutit, aucune modification n'est effectuée.
Aurelien-LWS Official answer
31 juil. 2023

Hello,

Thank you for your message.

We are not experiencing any particular problems with the operation of our services at present or since last Friday.

The problem may be due to your Internet connection, an IP block or the FTP transfer software you are using.

So that an agent can analyze your problem in detail and find a solution for you, I invite you to contact our technical support from the "support" section of your customer area.

Sincerely, The LWS team

Was this answer helpful?

A question about this article?

Ask the LWS team and the community. Answers are published after moderation.

Ask the LWS team and its community a question

RGPD : Responsable LWS-Ligne Web Services. Finalité : modération et publication publique de votre question, notification éventuelle d'une réponse. Base légale : consentement (art. 6.1.a RGPD). Conservation des emails : 90 jours après notification, 12 mois maximum sans réponse. Vous pouvez exercer vos droits via notre nos CGV - section RGPD.