SMTP

Simuler une réponse 551 User Not Local

The recipient is not local to this server and the server does not accept mail for forwarding. Unlike 251, this is a rejection — the server will not relay the message.

Voir la référence complète →

1 Réponse HTTP

Réponse HTTP
HTTP/1.1 551 User Not Local
Content-Type: application/json
Date: Tue, 25 Feb 2026 12:00:00 GMT
Content-Length: 54

{
  "error": "server_error",
  "message": "User Not Local"
}

2 Tester avec curl

terminal
curl -i https://httpbin.org/status/551

3 Retourner 551 User Not Local dans votre framework

django
from django.http import JsonResponse


def my_view(request):
    return JsonResponse(
        {"error": "server_error", "message": "User Not Local"},
        status=551,
    )
flask
from flask import Flask, jsonify

app = Flask(__name__)


@app.route("/endpoint")
def my_endpoint():
    return jsonify({"error": "server_error", "message": "User Not Local"}), 551
fastapi
from fastapi import FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()


@app.get("/endpoint")
def my_endpoint():
    return JSONResponse(
        content={"error": "server_error", "message": "User Not Local"},
        status_code=551,
    )
express.js
// Express.js
app.get('/endpoint', (req, res) => {
  res.status(551).json({"error": "server_error", "message": "User Not Local"});
});
spring boot
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

@RestController
public class MyController {

    @GetMapping("/endpoint")
    public ResponseEntity<Map<String, Object>> myEndpoint() {
        return ResponseEntity
            .status(551)
            .body(Map.of("error", "user_not_local",
                         "message", "User Not Local"));
    }
}
go net/http
package main

import (
    "encoding/json"
    "net/http"
)

func myHandler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(551)
    json.NewEncoder(w).Encode(map[string]string{
        "error":   "user_not_local",
        "message": "User Not Local",
    })
}
ruby on rails
class MyController < ApplicationController
  def my_action
    render json: {"error": "server_error", "message": "User Not Local"},
           status: :user_not_local
  end
end
asp.net core
// ASP.NET Core Minimal API
app.MapGet("/endpoint", () =>
    Results.Json(
        new { error = "user_not_local", message = "User Not Local" },
        statusCode: 551
    )
);

Plus de pages Mock SMTP