How should I pass info through email headers in Rails 3 - ruby

I'm working on a support app which would allow customers to mail to support#myapp.com and reply to this same email address. I have set up ticket+[id]#myapp.com to be visible within the support team whenever there's a new ticket created. I am using Cloudmailin for the incoming emails and SendGrid for outgoing.
I want to be able to store the ticket ID in the email headers of the email that is sent to the customer from support#myapp.com. When the customer replies to support#myapp.com, the app will then read the headers and know which ticket ID to route to. I have read up that it is not recommended to include X-custom headers as it would get stripped off by some mail servers.
There are some suggestions to use the Reply-To header to store the ticket ID but I can't seem to find that header in Cloudmailin.
Appreciate any suggestion on this matter.

I think you have the right idea in using the +'s to differentiate the emails. To read the incoming email header, you can use the headers[to] in cloudmailin.
Message Sender <sender#example.com>
------cloudmailinboundry
Content-Disposition: form-data; name="headers[To]"
Cloudmailin headers file

Related

How to ensure server has sent emails in Jmeter

I'm running a load test in jmeter for a registration scenario. In that scenario, there is a situation where an OTP is sent for the email address provided. Is there a way to ensure that the email has been sent when running the test script. All the email addresses i use are dummy addresses getting from a CSV file. I do not wish to read the email or get any data from it. I simply am required to know if the emails has been sent when a certain http request is hit.
I don't think you can "know if the emails has been sent" without actually receiving it so instead of "dummy" emails you can:
Set up a local mail server, i.e. test-mail-server or real email address(es)
Configure your application to use this test mail server (or real mail server) for sending emails
Configure JMeter to read emails from this test mail server using Mail Reader Sampler. Check out How to Create a JMeter Script to Check Email During Registration AND Grab the Confirmation URL article for more information.

TrustPilot Create Invitation API always returns 415 response code

I'm trying to send a TrustPilot invitation using the Create Invitations API but no matter what I try, I get a response code of 415 and with no data returned, so it's virtually impossible for me to debug.
The URL I'm using is correct: https://invitations-api.trustpilot.com/v1/private/business-units/{businessUnitId}/email-invitations (where {businessUnitId} is my business ID)
I am sending a valid (and current) oAuth token in my header.
I am sending a POST request.
I have tested my details with other "Business user OAuth Token" APIs and everything works, so my details are definitely correct. It's just this create invitation API that's not working.
I've tried everything. I've submitted minimal details, a full request, somewhere in between, the example request in the API, and so on. Always a response code of 415.
I've set my "Invitation Settings" in the TrustPilot Business portal, and have even tried submitting those details with the request (ie. sender e-mail "noreply.invitations#trustpilotmail.com" and a valid reply-to e-mail that's been configured).
I've tried contacting the "Integration Engineers" at TrustPilot who after a few back and forth e-mails, also have no idea, which is VERY unsettling. So time for Stack Overflow.
I need to get this figured out, so any help would be great! Perhaps someone can provide a sample request that works in their application that I can try to duplicate in mine?
Http status code 415 (Unsupported Media Type) is returned when Content-Type: application/json is not passed. You need to make sure that this header is added and that the content you are passing in the post body is valid json.
If you are already doing this then I would need an example of a request you are sending to help you further.

How to pass from and body as parameters in Twilio SMS webhook URL

I have a Twilio SMS number configured to send a request to a WebServer via a Webhook URL. What I am trying to understand is can I pass the 'from' phone number and 'SMS body' as parameters in the Webhook URL?
For example:
https://myserver/v1/sms?phoneNo='FROM'&message='MSG'
I understand I can extract this information from the Body on the server but this would require additional coding, testing, deployment etc... on the web server.
Thanks.
Keep the URL as https://myserver/v1/sms (Twilio will add the parameters for you when it makes the request)
To the right of the webhook url field, change in the drop-down from HTTP POST to HTTP GET
Save
With this configuration, Twilio will send the parameters with its request as URL query parameters.
The names for the two parameters mentioned in your question are
From (The phone number that sent the message) and
Body (The text body of the message.).
Other parameters are: MessageSid, SmsSid, AccountSid, MessagingServiceSid, To, NumMedia
You can read more here: https://www.twilio.com/docs/sms/twiml#twilios-request-to-your-application
If you'd like to have your own names for the GET parameters
then, probably the easiest would be to use Twilio Studio with a HTTP REQUEST widget and configure the phone number with Studio Flow instead of Webhook.
The HTTP REQUEST will let you make a GET request and add your own parameters to it.
For the values you would use {{trigger.message.From}} for your phoneNo and {{trigger.message.Body}} for your message.
You can read more about Twilio Studio's widgets here: https://www.twilio.com/docs/studio/widget-library#http-request

Customize OSB Mail alert body content

I am using Mail as alert-destination in OSB. From proxy service I am calling the alert destination and mail is being sent successfully.
However, the mail content is showing the details of service, destination, timestamp, server name etc details.
I just want to have the payload information in the mail body.
Is therey any way to customize the mail body when adding alert action in a proxy service?
Thanks in advance
The Alert action is very basic, and the email destination isn't really designed to be consumed by humans directly.
You're probably better off alerting to a JMS destination, then dequeuing it using a proxy to transform it into exactly what you want, then route to an SMTP Messaging business service to deliver the email (presumably formatted in HTML).

text/plain and text/html with c++ mail

I am using System::Net::Mail to send emails.
I was questioned about is it able to send two versions of email:
1) the html version of email for clients that can read html emails
2) text/plain for people who can't read html emails, and also the html version will be attached
is this possible using System::Net::Mail? I know how to enable HTML body version, but, how to send to types of message?
Thanks!
To let the recipient decide which version she wants to read, the mail needs to be composed using the multipart/alternative MIME type. System.Net.Mail supports this by means of the System.Net.Mail.MailMessage.AlternateViews collection.

Resources