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