bonjour j'ai dans mon thème classipress une fonction mail qui permet d'envoyer un message a l'email de l'administrateur par une formulaire qui se trouve dans une sidebar mais moi j'ai crée un champ de mail personnalisée qui porte le ID cp_email ou [code]get_post_meta( $post->ID, 'cp_city', true );[/code]et je veux que les message envoient a le contenu de ce champ et en tout les cas merci

Voici la fonction :

[code]// ad poster sidebar contact form email
function cp_contact_ad_owner_email($postID) {

// wp_mail doesn't seem to work with cc or bcc in headers (as of 2.9.2)
// this is here for adding it later
// $Cc = 'youremailaddress@domain.com';
// $Bcc = get_option('admin_email');

// check to see if ad is legacy or not
if(get_post_meta($postID, 'email', true))
    $mailto = get_post_meta($postID, 'email', true);
else
    $mailto = get_the_author_meta('user_email');

$from_name = strip_tags($_POST['from_name']);
$from_email = strip_tags($_POST['from_email']);
//$mailto = 'testing@appthemes.com'; // USED FOR TESTING
$subject = strip_tags($_POST['subject']);
$headers = "From: $from_name <$from_email> \r\n";
$headers .= "Reply-To: $from_name <$from_email> \r\n";
// $headers .= "Cc: $Cc \r\n";
// $headers .= "BCC: $Bcc \r\n";

// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails
$sitename = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$siteurl = trailingslashit(get_option('home'));
$permalink = get_permalink();

$message  = sprintf( __( 'Someone is interested in your ad listing: %s', APP_TD ), $permalink ) . "\r\n\r\n";
// $message  = sprintf( __( 'From: %s - %s', APP_TD ), $from_name, $from_email) . "\r\n\r\n";
    $fixPostMessage = stripslashes($_POST['message']);
$message .= '"' . wordwrap(strip_tags($fixPostMessage), 70) . '"' . "\r\n\r\n\r\n";
$message .= sprintf( __( 'Name: %s', APP_TD ), stripslashes($from_name) ) . "\r\n";
$message .= sprintf( __( 'E-mail: %s', APP_TD ), $from_email ) . "\r\n\r\n\r\n\r\n";
$message .= '-----------------------------------------' . "\r\n";
$message .= sprintf( __( 'This message was sent from %s', APP_TD ), $sitename ) . "\r\n";
$message .=  $siteurl . "\r\n\r\n";
    $message .= __( 'Sent from IP Address: ', APP_TD ) . appthemes_get_ip() . "\r\n\r\n"; 

// ok let's send the email
wp_mail($mailto, $subject, $message, $headers);

}
[/code]

Aucune réponse