我正在使用Twilio将SMS发送到也包含vCard附件的手机号码。
我正在使用:
Twilio.Rest.Api.V2010.Account
.MessageResource.CreateAsync(to: "some_number", from: "somenumber_1",
body: "Somedata", mediaUrl: "https://someurl/369a7012-0f7e-48ad-1212");
在https://someurl/369a7012-0f7e-48ad-1212
上方的是一个ASP.NET MVC控制器/端点,它将返回如下所示的vCard数据:
[HttpGet]
public async Task<ActionResult> VoiceHubvCard(string id)
{
var randomId = Guid.NewGuid().ToString();
Response.Clear();
//Response.AddHeader("Content-disposition", $"attachment; filename=\"{randomId}.vcf\";");
Response.AddHeader("Content-Disposition", $"attachment; filename=\"{randomId }.vcf\";");
var vCard = new VCard
{
Version = VCardVersion.V3,
FormattedName = $"Some dude name",
FirstName = "Dudes first name",
LastName = "Dudes last name",
Organization = "Google",
Telephones = new List<Telephone> { new Telephone { Number = "Dudes number", Type = TelephoneType.Work } }
};
var serializedvCard = vCard.Serialize();
return File(Encoding.UTF8.GetBytes(serializedvCard), "text/x-vcard; charset=utf-8");
}
我正在使用MixERP.Net.VCards.1.0.7
NuGet进行vCard撰写