Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by


Uploaded by


Virus scan

Safe to use

About this mod

Framework to use the in game mailbox. Console commands to adjust the mail. Code and Content Pack interfaces.

Permissions and credits
Simplify the send of mail to the player, giving more control over when and what should be received.
Also giving more options not possible just editing the data files, like changing the text color and background of the letter at will.

  1. Install the latest version of SMAPI.
  2. Unzip the MailFrameworkMod into /Stardew Valley/Mods.

Change Log:

  • Support for Rings as attachments.
  • New conditions for recipes.
  • New property for background customization with content packs.
  • Support to Close Button customization with content pack and code.
  • Support to i18n in content packs.
  • New conditions properties for buildings in the farm.
  • New conditions properties for mail received. (this is used for quest flags)
  • New conditions properties for events.
  • New conditions list for collections menu items.
  • New conditions list for game stats.
  • New property for friendship status for the conditions list for NPC friendship.
  • New random functionality for when Group Ids collide.
  • Fix to letters with no group ids being grouped together.
  • Letter will now be shown in the collection menu if an Title is defined. Custom textures and color will also show in the collection menu.
  • Letter now can have a group id. Letter with the same group id are never delivered in the same day.
  • New condition for content packs: "RandomChance".
  • BigObject is now called BigCraftable, like in the game code.
  • Fix of typos in the template.
  • Adds support to Stardew Valley 1.4.0
  • Adds Title property for Letters to be shown in the collection menu. Not fully implemented yet, but modders can start to set it.
  • Adds an content pack support for modders to add custom letters, with configurations to all features this framework provides, and with mostly common used delivery conditions.
  • Fix controllers not working to get attached items.
  • Fix to properly show attachments if the mail has more than one item attached.
  • Fix to not let the letter close if your inventory is full and a menu is opened to manage it.
  • Fix to not adding an stack of items to the mail even when configured to.
  • Adds support to SMAPI 3
  • Adds support to Stardew Valley 1.3.36
  • Adds support to SMAPI 3
  • Adds support to Stardew Valley 1.3.32
  • Adds commands to remove and add to the player received mail list.
  • Adds support to crafting recipes
  • Adds support to custom background
  • Adds support to custom text color
  • New way to open custom letter, now using harmony
  • Config file to enable old way of opening custom letters.
  • Support to i18n recipes.
  • Fix to the mod not working properly after returning to title menu.
  • Fix to no mail being delivered if the condition of a letter threw an exception.
  • Fix to receiving "tax passed" mail when sleeping and quit the game without having read a custom mail.
  • Custom mails can have recipes.
  • This version is not compatible with the older one. Mods need to be updated to use this version.
  • Add custom mails
  • Custom mails can have items.

For Modders to use content pack:
  • There is a template inside the mod folder with commented instructions on what each property do.
  • All letter features but the conditions and callback are the same as coding with the framework.
  • Conditions are limited to the ones implemented, and the callback always set the letter id as received. If you need advanced conditions you still should code them. Or you can politely suggest me to add a condition to the content pack, if its something that makes sense, I might add it.
  • Here is the template as added in the mod file:

For Modder to code:
  • Reference the MailFrameworkMod.dll on your SMAPI project.
    • You register your Letter using MailDao.SaveLetter(Letter)
    • At the begin of each day the mod will check for Letters that have reached its condition for delivery and add them to the mailbox.
    • This Letters will be opened first when the player check the mailbox.
    • When the Letter is opened, it is removed from the mailbox.
    • The callback condition of the letter is them called.
    • At the end of the day Letter still on the mailbox will be removed, so they are not saved by the game.
  • You can think of this mod as an repository for your letters. It works best if you load all your letter when the game loads.

Loading a simple Letter that will show for the player if not read before, and will not be be delivered again after being opened by the player:
new Letter(
,"Letter custom text."

Loading a simple Letter as before, but with 5 Emerald annexed:
  new Letter(
,"Letter custom text."
,new List<Item> { new StardewValley.Object(60,5) }

The player will not receive the same item, but a copy returned from the getOne() method.

Loading a simple Letter that will teach a cooking recipe, it will be delivered if the player doesn't know the recipe. The mod automatically teaches the recipes when the player loads, no need for a callback here:
  new Letter(
, "Letter custom text."
, "RecipeUniqueName"
, (l) => !Game1.player.cookingRecipes.ContainsKey(l.Recipe)

The "RecipeUniqueName" must be the same as stored on "Data//CookingRecipes" or "Data//CraftingRecipes".

Loading a simple Letter with different text and background:
  new Letter(
,"Letter custom text."

Loading a simple Letter with custom background:
  new Letter(
,"Letter custom text."
Where CustomLetterBG.png is a image file that follows the same structure as "LooseSprites//letterBG"

For more info: