When I send myself an email using sell.Notify.Email, the entire email appears as a single line email even though I have separated the lines using \r\n. The same text appears fine in a log file. Here is an example:

Here is how it appears in my email:

Canceling all open orders if any as it is time for fresh calculations bull signal bearish = False bond signal up = True latestVIX 17.02 9 day VIX SMA 16.64857142857143 5 day VIX SMA 16.353333333333335 high vola True high vola adjustments are applicable total_margin_use 1.5 bull_market_exposure 1.5 bear_market_exposure 0 total market exposure 1.5 liquidating because it is no longer a part of the universe: SPXU liquidating because it is no longer a part of the universe: TBT liquidating because it is no longer a part of the universe: UPRO liquidating because it is no longer a part of the universe: TTT liquidating because it is no longer a part of the universe: TMV liquidating because it is no longer a part of the universe: UBT Balancing/fresh orders for TQQQ with target weight of 0.0, current Quantity: -3908.0 needed

Here is how it appears in the log file:

Canceling all open orders if any as it is time for fresh calculations
bull signal bearish = False
bond signal up = True
latestVIX 17.89
9 day VIX SMA 17.31714285714286
5 day VIX SMA 17.12666666666667
high vola True
high vola adjustments are applicable
total_margin_use 0.8333333333333333
bull_market_exposure 1.5
bear_market_exposure 0
total market exposure 1.5
Balancing/fresh orders for VTV with target weight of 0.25, current Quantity: 0.0 needed Quantity(estimated): 177

---

The emails were formatted correctly but after I made some updates, it started ignoring the line breaks. I have following questions:

  • Any thoughts/tips on why it is happening?
  • Is there a way to test it without deploying it in a live environment? I believe the API does not take any action during backtesting. 
  • Is there any support for formatting the email using HTML?
  • Can I create a CSV file and email it as an attachment?