Here is how I do it in a bash script:
1 2 3 4 5 6 | wp option get wp_smtp_options --format=json | php -r ' $var = json_decode( fgets(STDIN) ); $var->from = "[email protected]"; $var->fromname = "me"; print json_encode($var); ' | wp option set wp_smtp_options --format=json |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.