{"action":"opened","issue":{"url":"https://api.github.com/repos/CalderaWP/Caldera-Forms/issues/932","repository_url":"https://api.github.com/repos/CalderaWP/Caldera-Forms","labels_url":"https://api.github.com/repos/CalderaWP/Caldera-Forms/issues/932/labels{/name}","comments_url":"https://api.github.com/repos/CalderaWP/Caldera-Forms/issues/932/comments","events_url":"https://api.github.com/repos/CalderaWP/Caldera-Forms/issues/932/events","html_url":"https://github.com/CalderaWP/Caldera-Forms/issues/932","id":189184168,"number":932,"title":"Default WP email is used when using caldera_forms_mailer filter.","user":{"login":"adamx12m","id":20650597,"avatar_url":"https://avatars.githubusercontent.com/u/20650597?v=3","gravatar_id":"","url":"https://api.github.com/users/adamx12m","html_url":"https://github.com/adamx12m","followers_url":"https://api.github.com/users/adamx12m/followers","following_url":"https://api.github.com/users/adamx12m/following{/other_user}","gists_url":"https://api.github.com/users/adamx12m/gists{/gist_id}","starred_url":"https://api.github.com/users/adamx12m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamx12m/subscriptions","organizations_url":"https://api.github.com/users/adamx12m/orgs","repos_url":"https://api.github.com/users/adamx12m/repos","events_url":"https://api.github.com/users/adamx12m/events{/privacy}","received_events_url":"https://api.github.com/users/adamx12m/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-14T18:10:35Z","updated_at":"2016-11-14T18:10:35Z","closed_at":null,"body":"Using calera_forms 1.4.4 and the caldera_forms_mailer to control recipient list based upon a form value, the default WP email is being set in the array by default.  Any recipient values added after are just appended.  Added the unset to the $mail['recipient'] array as the fix.  Not really a big problem but the docs https://calderawp.com/doc/caldera_forms_mailer/ should reflect this behavior.  Sending emails via postman_smtp plugin but shouldn't matter.\r\n\r\nadd_filter( 'caldera_forms_mailer', function( $mail, $data, $form ) {\r\n\t//MAKE SURE TO CHANGE FORM ID\r\n\tif( 'CF57068f9700961' == $form[ 'ID' ] ) {\r\n\r\n\t\tunset($mail[ 'recipients' ][0]);  // remove default admin user email id\r\n\r\n\t\t$state =  $data[ 'fld_6524634' ];\r\n\t\tswitch ($state) {\r\n\t\tcase \"Oklahoma\":\r\n\t\t $mail[ 'recipients' ][] = 'blahblah@blah.com';\r\n\t\tbreak;\r\n\t\tdefault:\r\n\t\t $mail[ 'recipients' ][] = 'blahmaster@blah.com';\r\n\t\t}\r\n\t}\r\n\treturn $mail;\r\n}, 10, 3 );"}}
{"actor":{"display_login":"adamx12m"}}