Setup and Configuration Guide
Complete setup instructions for MERA notifications.
โ ๏ธ Platform Support: Tested on macOS and Linux. Windows support not tested - use with caution on Windows systems.
๐ง Email Configuration
Requirements
- System mail client (macOS/Linux built-in, Windows requires setup)
- Valid email address that can receive emails
Step-by-Step Setup
Step 1: Create Email Configuration
Option A: Using Terminal (Linux/macOS)
# Navigate to home directory
cd ~
# Create email.txt with your email address
echo "your.email@example.com" > email.txt
# Verify the file was created correctly
cat email.txt
Option B: Manual Creation
- Create a new text file named
email.txt
in your home directory - Add only one line containing your email address
- Important: No extra spaces, quotes, or empty lines
- Save the file
Example email.txt
content:
researcher@university.edu
Step 2: Verify Mail System
Check if mail command exists:
which mail
# Should return a path like /usr/bin/mail (macOS/Linux)
Test email functionality:
echo "MERA setup test" | mail -s "Test from MERA" your.email@example.com
Step 3: Platform-Specific Notes
macOS: Built-in mail command works out of the box Linux: Usually pre-installed; install if needed:
# Ubuntu/Debian
sudo apt-get install mailutils
# CentOS/RHEL
sudo yum install mailx
Windows: Requires additional setup (consider using Zulip only). Note: Windows support not tested.
๐ฌ Zulip Configuration
Step 1: Create a Zulip Bot
Important: Use a Generic bot (not Incoming webhook) for full functionality.
- Log in to your Zulip server
- Go to Settings > Your bots
- Click Add a new bot
- Select "Generic bot" type
- Enter name (e.g.,
mera-bot
) - Copy the bot email and API key
- Note your server URL
Step 2: Create Configuration File
Option A: Using Terminal (Linux/macOS)
# Navigate to home directory
cd ~
# Create zulip.txt with your bot credentials
cat > zulip.txt << EOF
mera-bot@zulip.yourdomain.com
your-api-key-here
https://zulip.yourdomain.com
EOF
# Set secure permissions
chmod 600 zulip.txt
Option B: Manual Creation
- Create a new text file named
zulip.txt
in your home directory - Add exactly three lines:
- Line 1: Your bot email (e.g.,
mera-bot@yourlab.zulipchat.com
) - Line 2: Your bot API key (long string from bot settings)
- Line 3: Your Zulip server URL (e.g.,
https://yourlab.zulipchat.com
)
- Line 1: Your bot email (e.g.,
- Save the file
- Important: No extra spaces, empty lines, or comments
- Critical: Server URL must include
https://
prefix (not justyourlab.zulipchat.com
)
Example zulip.txt
content:
mera-computation-bot@mylab.zulipchat.com
a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6
https://mylab.zulipchat.com
Step 3: Create Channels
Create these recommended channels in Zulip:
mera-personal
- Your private notificationsresearch
- Research-related alertserrors
- Error notificationsprogress
- Long-running job updates
โก Important: Multiple Methods Behavior
Key Point: If you configure both email and Zulip, notifyme()
sends to BOTH methods simultaneously.
Notification Matrix
Configuration | notifyme("Hello!") sends to: |
---|---|
Only ~/email.txt | โ Email only |
Only ~/zulip.txt | โ Zulip only |
Both files exist | โ Both email AND Zulip |
No config files | โ Nothing (silent) |
Examples
# With both email.txt and zulip.txt configured:
notifyme("Analysis complete!")
# Result: Email sent to your.email@example.com
# AND Zulip message sent to #alerts channel
# If you want only email for this message:
# Temporarily rename zulip.txt or use system-specific method
๐ก Tip: Most users find the "send to all configured methods" behavior useful for important notifications, but be aware that you'll get multiple notifications for each call.
๐ง Verification
Test your setup:
using Mera
# Test basic notification
notifyme("Setup test - basic message")
# Test with custom channel
notifyme("Setup test - custom channel",
zulip_channel="mera-personal",
zulip_topic="Configuration Test")
# Test output capture
notifyme("Setup test - with output",
capture_output=`julia --version`)
๐ ๏ธ Troubleshooting
Common Issues
Email not working:
- Check if
mail
command exists:which mail
- Verify email.txt format (no extra whitespace)
- Test manual email:
echo "test" | mail -s "test" you@example.com
Zulip authentication failed:
- Verify bot type is "Generic" not "Incoming webhook"
- Check API key has no extra characters
- Ensure server URL includes
https://
prefix (common mistake) - Ensure bot has access to target channels
- Test bot permissions in Zulip web interface
Channel not found:
- Create channels manually in Zulip web interface
- Check channel names for typos
- Ensure bot is subscribed to target channels
File upload failed:
- Check file exists and is readable
- Verify file size (default limit: 25 MB)
- Images auto-optimize; check for image processing errors
- Server may have stricter limits than client
Debug Mode
Enable verbose output:
# Check configuration status
println("Email configured: ", isfile(homedir() * "/email.txt"))
println("Zulip configured: ", isfile(homedir() * "/zulip.txt"))
# Test with error handling
try
notifyme("Debug test")
println("โ
Notification sent successfully")
catch e
println("โ Error: ", e)
end
๐ Security Notes
- Keep
zulip.txt
private (considerchmod 600 ~/zulip.txt
) - Use bot accounts, not personal API keys
- Regularly rotate API keys
- Monitor bot activity in Zulip
- Be cautious with system information capture in shared channels