I'm sending (plain text) emails containing urls to a web site. They look like:
https://www.example.com/account/confirm/?place_id=ChIJA5Vy7Qfp2UcRpbHr9bNg4Tw
(The place_id parameter is a Place ID from the Google Maps API)
But my server logs show entries like
GET /account/confirm/?place_id=DuVWjMw28Eld43dEZhEcXEDcJfd
This only happens sometimes, I have plenty of entries that look as expected:
GET /account/confirm/?place_id=ChIJA5Vy7Qfp2UcRpbHr9bNg4Tw
And if I send test emails to myself, I get the correct URLs
Does anyone know what might be happening: how are these parameters getting mangled?. I'm using the following ruby code, running on AWS Lambda. The code connects via SMTP to a Gmail account:
require 'json'require 'mail'require 'securerandom'def lambda_handler(event:, context:) eventBody = JSON.parse(event["body"]) smtp = eventBody['smtp'] Mail.defaults do delivery_method :smtp, { address: smtp['address'], port: smtp['port'], user_name: smtp['username'], password: smtp['password'], authentication: smtp['authentication'], enable_starttls_auto: smtp['enable_starttls_auto'] } end mailConfig = eventBody['mail'] mail = Mail.new do message_id "<#{SecureRandom.uuid.upcase}@#{mailConfig['from']['address'].split('@').last}>" to mailConfig['to'] from "#{mailConfig['from']['name']} <#{mailConfig['from']['address']}>" subject mailConfig['subject'] unless mailConfig['body'].nil? body mailConfig['body'] end end unless mailConfig['body_text'].nil? mail.text_part = Mail::Part.new do body mailConfig['body_text'] end end unless mailConfig['body_html'].nil? mail.html_part = Mail::Part.new do content_type 'text/html; charset=UTF-8' body mailConfig['body_html'] end end unless mailConfig['headers'].nil? mailConfig['headers'].each do |name, value| mail.header[name] = value end end { statusCode: 201, body: JSON.generate({ # event: event, # body: eventBody, # context: context, mail: mail.to_s })}