跳到主要内容

Email / SMTP Setup

FeedbackPulse sends various transactional emails. Proper email configuration is important for:

  • Welcome emails to new tenants
  • Team invitation links
  • Password reset emails
  • Email OTP verification (for 反馈表单s)
  • Daily/weekly digests
  • Scheduled reports
  • Usage alerts
  • Plan change notifications

⚙️ 配置 Methods

  1. 登录 as superadmin
  2. 前往 Admin → 设置 → Email
  3. Fill in your SMTP details
  4. Click Send Test Email to verify
  5. Save

Method 2: Via .env File

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="FeedbackPulse"

📮 Provider-Specific Setup

📧 Gmail

MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_app_password
MAIL_ENCRYPTION=tls

⚠️ 重要: Gmail requires an App Password, not your regular password.

  1. 前往 Google Account 安全
  2. Enable 2-Step Verification (required)
  3. 前往 App passwords → select "Mail" → generate
  4. Use the generated 16-character password

🔴 Gmail limits: 500 emails/day (personal) or 2,000/day (Workspace). Not recommended for production SaaS.

🔫 Mailgun

MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_mailgun_smtp_password
MAIL_ENCRYPTION=tls
  1. 注册 at Mailgun
  2. Add your domain → verify DNS records
  3. 前往 Sending → Domain 设置 → SMTP credentials
  4. Copy the SMTP password

📦 Amazon SES

MAIL_HOST=email-smtp.us-east-1.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=your_ses_smtp_username
MAIL_PASSWORD=your_ses_smtp_password
MAIL_ENCRYPTION=tls
  1. 前往 AWS SES Console
  2. Verify your domain
  3. 前往 SMTP 设置 → Create SMTP Credentials
  4. Move out of sandbox mode for production

📨 SendGrid

MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=your_sendgrid_api_key
MAIL_ENCRYPTION=tls

💡 注意: The username is literally apikey (not your email). The password is your SendGrid API key.

✉️ Postmark

MAIL_HOST=smtp.postmarkapp.com
MAIL_PORT=587
MAIL_USERNAME=your_postmark_server_api_token
MAIL_PASSWORD=your_postmark_server_api_token
MAIL_ENCRYPTION=tls

🔵 ZOHO Mail

MAIL_HOST=smtp.zoho.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_zoho_password
MAIL_ENCRYPTION=tls

🧪 Mailtrap (Testing Only!)

MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=tls

⚠️ Mailtrap is for development/testing only. Emails are captured in your Mailtrap inbox and never delivered to real recipients.


🧪 Testing Email

Via Admin Panel

  1. 前往 Admin → 设置 → Email
  2. Click Send Test Email
  3. Check your inbox

Via Command Line

php artisan tinker
Mail::raw('Test email from FeedbackPulse', function ($message) {
$message->to('[email protected]')->subject('SMTP Test');
});

📨 Emails Sent by FeedbackPulse

EmailWhenRecipient
WelcomeNew tenant registersTenant admin
Team InvitationAdmin invites team memberInvitee email
Plan ChangedSubscription changesTenant admin
New Submission AlertNew feedback receivedTenant admin/staff
Email DigestDaily/weekly scheduleTenant admin
Scheduled ReportDaily/weekly/monthlyTenant admin
Usage Alert90%+ of plan limitTenant admin
Password ResetUser requests resetRequesting user
Email VerificationNew registrationNew user
OTP CodeFeedback form with OTPEnd user submitting feedback

🐛 故障排除 Email

IssueSolution
Emails not sendingCheck .env SMTP settings. Try MAIL_MAILER=log to test without SMTP. Check storage/logs/laravel.log.
Emails going to spamAdd SPF, DKIM, and DMARC records to your domain's DNS. Use a reputable SMTP provider.
"Connection timed out"Port 587/465 might be blocked by your hosting provider. Try a different port or provider.
Gmail "Less secure apps" errorUse App Password instead. See Gmail section above.
Emails delayedIf using QUEUE_CONNECTION=database, make sure the queue worker is running.

⏭️ 下一步