@@ -199,66 +199,6 @@ curl -X POST "http://localhost:9876/api/send-email" \
199199 }'
200200```
201201
202- ### Intégration Python
203-
204- ``` python
205- import requests
206- import json
207-
208- def send_email (to_email , subject , content ):
209- url = " http://localhost:9876/api/send-email"
210- payload = {
211- " receiver_email" : to_email,
212- " email_object" : subject,
213- " message_text" : content
214- }
215-
216- response = requests.post(url, json = payload)
217-
218- if response.status_code == 200 :
219- print (" Email envoyé avec succès !" )
220- return True
221- else :
222- print (f " Erreur lors de l'envoi : { response.text} " )
223- return False
224-
225- # Utilisation
226- send_email(
227- to_email = " client@example.com" ,
228- subject = " Confirmation de commande" ,
229- content = " <h2>Votre commande est confirmée</h2><p>Numéro : #12345</p>"
230- )
231- ```
232-
233- ### Intégration JavaScript/Node.js
234-
235- ``` javascript
236- const axios = require (' axios' );
237-
238- async function sendEmail (toEmail , subject , content ) {
239- try {
240- const response = await axios .post (' http://localhost:9876/api/send-email' , {
241- receiver_email: toEmail,
242- email_object: subject,
243- message_text: content
244- });
245-
246- console .log (' Email envoyé avec succès !' );
247- return response .data ;
248- } catch (error) {
249- console .error (' Erreur lors de l\' envoi :' , error .response .data );
250- throw error;
251- }
252- }
253-
254- // Utilisation
255- sendEmail (
256- ' client@example.com' ,
257- ' Notification importante' ,
258- ' <p>Votre compte a été mis à jour.</p>'
259- );
260- ```
261-
262202### Vérification du statut SMTP
263203
264204``` bash
0 commit comments