Search code examples
drupaldrupal-6drupal-modules

mail function headers


I am using the function below to send out email to a thirdparty once a user comes to a perticular page on my site However, when the thirdparty recieves the email and wants to reply, it comes back to me instead of going to that user. I want to add a reply-to field but havent found that anywhere in drupal docs. Below is my code

function MYMODULE_mail($key, &$message, $params) {  

                    switch ($key) {  
                                    case 'dept':  

                                    $message['subject'] = "subject";  

                                    $message['body'] = "some text";                  
                                    break;  
                    }  
    }


    if($GLOBALS['user']->uid){
    drupal_mail('MYMODULE', 'dept', 'thirdparty@testemail.com', language_default(), $params); 

Solution

  • fixed it using this

    switch ($key) {  
                                        case 'dept':  
    
                                        $message['subject'] = "subject"; 
                                        $message['Reply-to'] = "replyinaddress@addressemail.com";  
    
                                        $message['body'] = "some text";                  
                                        break;  
                        }