1
我可以知道“在我的网站上使用Windows Azure接收来自客户的电子邮件”吗?如何在我的网站上使用Windows Azure接收电子邮件
现在我正在创建我的公司网站。在本网站中,我将创建“联系我们”页面。 此页面将接受来自我的客户的电子邮件。 但是这个邮件不能通过使用WIndows Azure直接到达我的服务器。
本页我将用PHP语言创建。
我可以创建此功能吗?
如何创建此页面?你知道如何做到这一点?
我可以知道“在我的网站上使用Windows Azure接收来自客户的电子邮件”吗?如何在我的网站上使用Windows Azure接收电子邮件
现在我正在创建我的公司网站。在本网站中,我将创建“联系我们”页面。 此页面将接受来自我的客户的电子邮件。 但是这个邮件不能通过使用WIndows Azure直接到达我的服务器。
本页我将用PHP语言创建。
我可以创建此功能吗?
如何创建此页面?你知道如何做到这一点?
Windows Azure环境本身当前不提供SMTP中继或邮件中继服务。史蒂夫马克思拼,做了
下一个伟大的示例应用程序(available for download here):
它使用第三方服务(SendGrid)从内部 Windows Azure中发送电子邮件。
它使用辅助角色与输入端点侦听SMTP 通信端口25
它使用自定义域名在CDN端点缓存斑点。
这里有一个处理一个传入电子邮件的代码:
// make a container, with public access to blobs
var id = Guid.NewGuid().ToString().Replace("-", null);
var container = account.CreateCloudBlobClient().GetContainerReference(id);
container.Create();
container.SetPermissions(new BlobContainerPermissions() { PublicAccess=BlobContainerPublicAccessType.Blob });
// parse the message
var msg = new SharpMessage(new MemoryStream(Encoding.ASCII.GetBytes(message.Data)),
SharpDecodeOptions.AllowAttachments | SharpDecodeOptions.AllowHtml | SharpDecodeOptions.DecodeTnef);
// create a permalink-style name for the blob
var permalink = Regex.Replace(Regex.Replace(msg.Subject.ToLower(), @"[^a-z0-9]", "-"), "--+", "-").Trim('-');
if (string.IsNullOrEmpty(permalink))
{
// in case there's no subject
permalink = "message";
}
var bodyBlob = container.GetBlobReference(permalink);
// set the CDN to cache the object for 2 hours
bodyBlob.Properties.CacheControl = "max-age=7200";
// replaces references to attachments with the URL of where we'll put them
msg.SetUrlBase(Utility.GetCdnUrlForUri(bodyBlob.Uri) + "/[Name]");
// save each attachment in a blob, setting the appropriate content type
foreach (SharpAttachment attachment in msg.Attachments)
{
var blob = container.GetBlobReference(permalink + "/" + attachment.Name);
blob.Properties.ContentType = attachment.MimeTopLevelMediaType + "/" + attachment.MimeMediaSubType;
blob.Properties.CacheControl = "max-age=7200";
attachment.Stream.Position = 0;
blob.UploadFromStream(attachment.Stream);
}
// add the footer and save the body to the blob
SaveBody(msg, bodyBlob, message, container, permalink);
你能具体谈谈你想做什么? –
我想通过在我公司的网站上传入windows azure来接收电子邮件给我的服务器。我可以创建这个函数吗?如果我可以创建,我想要一个这个函数的例子。 – ammoe