Comment envoyer un email en utilisant wp_mail et en utilisant plus d'un BCC dans l'en-tête
1 réponses
- votes
-
- 2015-06-02
$ headerspeut être une chaîne ou untableau,maisilpeut êtreplus simple à utiliser dans laforme detableau. Pour l'utiliser,poussez une chaîne sur letableau,en commençantpar "From:","Bcc:" ou "Cc:" (notez l'utilisation du ":"),suivi d'un adressee-mail valide.
En d'autrestermes:
$headers = array( 'From: [email protected]', 'CC: [email protected]', 'CC: [email protected]', 'BCC: [email protected]', 'BCC: [email protected]' );
Vouspouvez voir où le Core analyse la chaîneen la divisant sur ce ":" :
296 list( $name, $content ) = explode( ':', trim( $header ), 2 ); 297 298 // Cleanup crew 299 $name = trim( $name ); 300 $content = trim( $content ); 301 302 switch ( strtolower( $name ) ) { 303 // Mainly for legacy -- process a From: header if it's there 304 case 'from':
Remarque: cecin'apas ététestémaisje suis assez confiant. Jene voulaispas commencer àenvoyer dese-mails à des adresses sans avertissement (si ce sontmême des adresses actives).
$headers can be a string or an array, but it may be easiest to use in the array form. To use it, push a string onto the array, starting with "From:", "Bcc:" or "Cc:" (note the use of the ":"), followed by a valid email address.
In other words:
$headers = array( 'From: [email protected]', 'CC: [email protected]', 'CC: [email protected]', 'BCC: [email protected]', 'BCC: [email protected]' );
You can see where the Core parses the string by splitting it on that ":":
296 list( $name, $content ) = explode( ':', trim( $header ), 2 ); 297 298 // Cleanup crew 299 $name = trim( $name ); 300 $content = trim( $content ); 301 302 switch ( strtolower( $name ) ) { 303 // Mainly for legacy -- process a From: header if it's there 304 case 'from':
Note: This is untested but I am fairly confident. I did not want to start sending email to addresses without warning (if those are even active addresses).
-
La seule chose quej'ai changépour que celafonctionneest d'utiliser $ headeret non $group_emails. TNX!The only thing I changed for it to work is using $header and not $group_emails. TNX!
- 0
- 2015-06-07
- Kar19
-
Pouvez-vouspublier votre codefinal?L'aide sera appréciée.Can you post your final code? Help will be appreciated.
- 1
- 2019-08-08
- The WP Intermediate
J'ai cettepartie de code quiest chargée d'obtenir les variables duformulaire de contactet dem'envoyer une-mail àmoiet àmes amis dutravail.
Je souhaite ajouter auxen-têtes 4e-mailsen BCC.
Commentfaire ça correctement? J'aiessayé quelques variantes de l'écriture sans aucun succès.