“UbuntuHelp:ThunderbirdDefaultMailerHowto”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第9行: | 第9行: | ||
* Open a text editor and copy-and-paste the following shell script: | * Open a text editor and copy-and-paste the following shell script: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | #!/bin/bash | + | #!/bin/bash |
− | # mailto - handle mailto: links by opening the composer in thunderbird | + | |
− | # Author: Christopher Arndt <chris at chrisarndt dot de> | + | # mailto - handle mailto: links by opening the composer in thunderbird |
− | # find thunderbird executable | + | |
− | for prog in thunderbird mozilla-thunderbird; do | + | # Author: Christopher Arndt <chris at chrisarndt dot de> |
− | if [ -n "$(which "$prog" 2>/dev/null)" ]; then | + | |
− | TB="$prog" | + | # find thunderbird executable |
− | break | + | for prog in thunderbird mozilla-thunderbird; do |
− | fi | + | if [ -n "$(which "$prog" 2>/dev/null)" ]; then |
− | done | + | TB="$prog" |
− | if [ -z "$TB" ]; then | + | break |
− | echo "Thunderbird executable not found." 2>&1 | + | fi |
− | exit 1 | + | done |
− | fi | + | |
− | if $TB -remote "ping()" &>/dev/null; then | + | if [ -z "$TB" ]; then |
− | # strip "mailto:" prefix when using -remote | + | echo "Thunderbird executable not found." 2>&1 |
− | CMD="${1#mailto:}" | + | exit 1 |
− | exec $TB -remote "mailto($CMD)" &>/dev/null | + | fi |
− | else | + | |
− | # suppress any output from thunderbird to stdout/stderr | + | if $TB -remote "ping()" &>/dev/null; then |
− | # remove "&>/dev/null" if you don't like this | + | # strip "mailto:" prefix when using -remote |
− | exec $TB "$@" &>/dev/null | + | CMD="${1#mailto:}" |
− | fi | + | exec $TB -remote "mailto($CMD)" &>/dev/null |
− | </nowiki></pre> | + | else |
+ | # suppress any output from thunderbird to stdout/stderr | ||
+ | # remove "&>/dev/null" if you don't like this | ||
+ | exec $TB "$@" &>/dev/null | ||
+ | fi | ||
+ | </nowiki></pre> | ||
* Save this shell script to a file named `mailto`. | * Save this shell script to a file named `mailto`. | ||
* Then open a terminal window, change to the directory where you saved the script and issue the following command: | * Then open a terminal window, change to the directory where you saved the script and issue the following command: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | sudo install mailto /usr/local/bin | + | sudo install mailto /usr/local/bin |
− | </nowiki></pre> | + | </nowiki></pre> |
This will install the shell script into `/usr/local/bin` and make it executable. | This will install the shell script into `/usr/local/bin` and make it executable. | ||
Now, when you click on a `mailto:` link in Firefox, Thunderbird will open a new composer window. When Thunderbird is already running, it will not start another instance of Thunderbird, but will just ask Thunderbird to open a new message window. This prevents Thunderbird from trying to open a new instance with a different user profile. | Now, when you click on a `mailto:` link in Firefox, Thunderbird will open a new composer window. When Thunderbird is already running, it will not start another instance of Thunderbird, but will just ask Thunderbird to open a new message window. This prevents Thunderbird from trying to open a new instance with a different user profile. |
2007年12月6日 (四) 10:56的版本
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
This Howto shows how to make Thunderbird your default e-mailer in GNOME and for Firefox `mailto:` links. Please carry out the following steps:
- Open the menu on the panel and select System -> Preferences -> Preferred Applications.
Open the Mail Reader tab and select the Custom checkbox. In the text field next to it, enter: `mailto %s` Now, click the Close button.
- Open a text editor and copy-and-paste the following shell script:
#!/bin/bash # mailto - handle mailto: links by opening the composer in thunderbird # Author: Christopher Arndt <chris at chrisarndt dot de> # find thunderbird executable for prog in thunderbird mozilla-thunderbird; do if [ -n "$(which "$prog" 2>/dev/null)" ]; then TB="$prog" break fi done if [ -z "$TB" ]; then echo "Thunderbird executable not found." 2>&1 exit 1 fi if $TB -remote "ping()" &>/dev/null; then # strip "mailto:" prefix when using -remote CMD="${1#mailto:}" exec $TB -remote "mailto($CMD)" &>/dev/null else # suppress any output from thunderbird to stdout/stderr # remove "&>/dev/null" if you don't like this exec $TB "$@" &>/dev/null fi
- Save this shell script to a file named `mailto`.
- Then open a terminal window, change to the directory where you saved the script and issue the following command:
sudo install mailto /usr/local/bin
This will install the shell script into `/usr/local/bin` and make it executable. Now, when you click on a `mailto:` link in Firefox, Thunderbird will open a new composer window. When Thunderbird is already running, it will not start another instance of Thunderbird, but will just ask Thunderbird to open a new message window. This prevents Thunderbird from trying to open a new instance with a different user profile. If the `mailto` script is started without arguments, and Thunderbird is not already running, it will just open the Thunderbird main window. If it detects a running Thunderbird, it will open a new message window with an empty `To:` address line.