use noreply for emails, changing support email to reduce spam, less email notifications

This commit is contained in:
Kyle Drake 2025-07-27 14:45:36 -05:00
parent 3237ee6809
commit 5d56e12561
11 changed files with 16 additions and 44 deletions

10
app.rb
View file

@ -125,16 +125,6 @@ not_found do
end end
error do error do
=begin
EmailWorker.perform_async({
from: 'web@neocities.org',
to: 'errors@neocities.org',
subject: "[Neocities Error] #{env['sinatra.error'].class}: #{env['sinatra.error'].message}",
body: erb(:'templates/email/error', layout: false),
no_footer: true
})
=end
if @api if @api
api_error 500, 'server_error', 'there has been an unknown server error, please try again later' api_error 500, 'server_error', 'there has been an unknown server error, please try again later'
end end

View file

@ -194,7 +194,7 @@ post '/admin/email' do
queued_sites.each do |site| queued_sites.each do |site|
EmailWorker.perform_at((day.days.from_now + seconds), { EmailWorker.perform_at((day.days.from_now + seconds), {
from: 'Kyle from Neocities <kyle@neocities.org>', from: Site::FROM_EMAIL,
to: site.email, to: site.email,
subject: params[:subject], subject: params[:subject],
body: params[:body] body: params[:body]

View file

@ -36,9 +36,9 @@ post '/contact' do
end end
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
reply_to: params[:email], reply_to: params[:email],
to: 'contact@neocities.org', to: $config['support_email'],
subject: subject, subject: subject,
body: body, body: body,
no_footer: true no_footer: true

View file

@ -121,7 +121,7 @@ post '/create' do
@site.phone_verification_required = true if self.class.production? && BlackBox.phone_verification_required?(@site) @site.phone_verification_required = true if self.class.production? && BlackBox.phone_verification_required?(@site)
rescue => e rescue => e
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
to: 'errors@neocities.org', to: 'errors@neocities.org',
subject: "[Neocities Error] Phone verification exception", subject: "[Neocities Error] Phone verification exception",
body: "#{e.inspect}\n#{e.backtrace}", body: "#{e.inspect}\n#{e.backtrace}",

View file

@ -24,7 +24,7 @@ post '/dmca/contact' do
erb :'dmca' erb :'dmca'
else else
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
reply_to: params[:email], reply_to: params[:email],
to: 'dmca@neocities.org', to: 'dmca@neocities.org',
subject: "[Neocities DMCA Notice]: #{params[:subject]}", subject: "[Neocities DMCA Notice]: #{params[:subject]}",

View file

@ -169,7 +169,7 @@ the Neocities Cat
body.strip! body.strip!
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
to: params[:email], to: params[:email],
subject: '[Neocities] Username lookup', subject: '[Neocities] Username lookup',
body: body body: body

View file

@ -1,12 +1,4 @@
post '/webhooks/paypal' do post '/webhooks/paypal' do
EmailWorker.perform_async({
from: 'web@neocities.org',
to: 'errors@neocities.org',
subject: "[Neocities Paypal Webhook] Received a Webhook from Paypal",
body: params.inspect,
no_footer: true
})
'ok' 'ok'
end end
@ -57,7 +49,7 @@ post '/webhooks/paypal/tipping_notify' do
) )
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
to: params[:payer_email], to: params[:payer_email],
subject: "You sent a #{@tip.amount_string} tip!", subject: "You sent a #{@tip.amount_string} tip!",
body: Tilt.new('./views/templates/email/tip_sent.erb', pretty: true).render(self) body: Tilt.new('./views/templates/email/tip_sent.erb', pretty: true).render(self)
@ -66,24 +58,12 @@ end
post '/webhooks/stripe' do post '/webhooks/stripe' do
event = JSON.parse request.body.read event = JSON.parse request.body.read
if event['type'] == 'customer.created'
username = event['data']['object']['description'].split(' - ').first
email = event['data']['object']['email']
EmailWorker.perform_async({
from: 'web@neocities.org',
to: 'contact@neocities.org',
subject: "[Neocities] New customer: #{username}",
body: "#{username}\n#{email}\n#{Site[username: username].uri}",
no_footer: true
})
end
if event['type'] == 'charge.failed' if event['type'] == 'charge.failed'
site = stripe_get_site_from_event event site = stripe_get_site_from_event event
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
to: site.email, to: site.email,
subject: "[Neocities] There was an issue charging your card", subject: "[Neocities] There was an issue charging your card",
body: Tilt.new('./views/templates/email/charge_failure.erb', pretty: true).render(self) body: Tilt.new('./views/templates/email/charge_failure.erb', pretty: true).render(self)
@ -98,7 +78,7 @@ post '/webhooks/stripe' do
site.save_changes validate: false site.save_changes validate: false
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
to: site.email, to: site.email,
subject: "[Neocities] Supporter plan has ended", subject: "[Neocities] Supporter plan has ended",
body: Tilt.new('./views/templates/email/supporter_ended.erb', pretty: true).render(self) body: Tilt.new('./views/templates/email/supporter_ended.erb', pretty: true).render(self)
@ -112,7 +92,7 @@ post '/webhooks/stripe' do
invoice_obj = event['data']['object'] invoice_obj = event['data']['object']
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: Site::FROM_EMAIL,
to: site.email, to: site.email,
subject: "[Neocities] Invoice", subject: "[Neocities] Invoice",
body: Tilt.new('./views/templates/email/invoice.erb', pretty: true).render( body: Tilt.new('./views/templates/email/invoice.erb', pretty: true).render(
@ -127,7 +107,6 @@ post '/webhooks/stripe' do
end end
end end
'ok' 'ok'
end end

View file

@ -85,7 +85,7 @@ def send_confirmation_email(site=current_site)
EmailWorker.perform_async({ EmailWorker.perform_async({
from: 'web@neocities.org', from: 'web@neocities.org',
reply_to: 'contact@neocities.org', reply_to: 'noreply@neocities.org',
to: site.email, to: site.email,
subject: "[Neocities] Confirm your email address", subject: "[Neocities] Confirm your email address",
body: Tilt.new('./views/templates/email/confirm.erb', pretty: true).render(self, site: site) body: Tilt.new('./views/templates/email/confirm.erb', pretty: true).render(self, site: site)

View file

@ -29,3 +29,4 @@ minfraud_license_key: DERPDERPDERP
google_custom_search_key: herpderp google_custom_search_key: herpderp
google_custom_search_cx: herpderp google_custom_search_cx: herpderp
google_custom_search_query_limit: 69 google_custom_search_query_limit: 69
support_email: derp@example.com

View file

@ -31,6 +31,7 @@ development:
google_custom_search_key: herpderp google_custom_search_key: herpderp
google_custom_search_cx: herpderp google_custom_search_cx: herpderp
google_custom_search_query_limit: 69 google_custom_search_query_limit: 69
support_email: derp@example.com
test: test:
database: 'postgres://localhost/neocities_test' database: 'postgres://localhost/neocities_test'
database_pool: 1 database_pool: 1
@ -68,3 +69,4 @@ test:
google_custom_search_key: herpderp google_custom_search_key: herpderp
google_custom_search_cx: herpderp google_custom_search_cx: herpderp
google_custom_search_query_limit: 69 google_custom_search_query_limit: 69
support_email: derp@example.com

View file

@ -121,7 +121,7 @@ class Site < Sequel::Model
IP_CREATE_LIMIT = 1000 IP_CREATE_LIMIT = 1000
TOTAL_IP_CREATE_LIMIT = 10000 TOTAL_IP_CREATE_LIMIT = 10000
FROM_EMAIL = 'noreply@neocities.org' FROM_EMAIL = 'Neocities <noreply@neocities.org>'
PLAN_FEATURES = {} PLAN_FEATURES = {}