English 中文(简体)
传真电子邮件模板作为NSString
原标题:HTML Email Template as NSString
  • 时间:2010-03-10 16:30:11
  •  标签:
  • iphone
  • email

我在给我的信中增添了功能,使我能够把一些相当详细的信息发送电子邮件。 我谨以超文本格式发送电子邮件,以便我能够利用超文本和安保部的搭配。

我想采取的办法是设计模板,为拟填充的田地设计主,将模板装入国家抽样调查中,然后使用插座替换来用实际数据更改地主。

a. 不是有一条乌乌卢格线,例如:

NSString *emailTemplate = [NSString stringWithFormat:@"<h1>TITLE</h1><hr noshade/><p>Here is the information about the thing that you are interested in. Find more from the table below:</p> . . ."]

我更想这样做。 我是否应该把模板写成一个文件,然后装上它? 这样做的最佳途径是什么?

而且,我如何能够以地方性的方式做到这一点?

感谢!

问题回答

我不相信以当地可行方式做到这一点的最佳方式,但是,如果你需要的话,将超文本写成自己的文件......html,并将该文档的内容读到“密码”中。

你们可以这样做。

+ (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error

如果你使用这种方法,你需要打电话到<条码>可互换的Copy。 Don tabes, 采用 可变异的,将退回一个新的NSMutableString, 表示在你完成学业时,你有责任释放。

然后,你可以走到前面,使用。

- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)opts range:(NSRange)searchRange

用你的内容取代持有人。

这样做的好处意味着,你可以很容易地利用WYSIWYG编辑或你的偏爱的IDE编辑篡改超文本,而不必在你看来改动该代码。 你们还可以审查一下它喜欢的那种方式。





相关问题
Angle brackets in php

I want to store angle brackets in a string in PHP because i want to eventually use mail() to send an HTML email out. The following is the code that doesn t seem to work. while(...) { $msg .= "<...

authlogic auto_register feature using my options

I have auto registration working with authlogic using gaizka s version of authlogic_openid which I found on Github since pelle s original addition of the feature seemed to cause issues. http://...

Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

How to track an email in Java?

How I can track an email? I m using java on the server side for sending emails. I want to track whether it is delivered , opened, etc... How I can do that ?

Web Link in a mail is not rendering as link in yahoo

string from = "abc@gmail.com"; string to = "xyz@gmail.com,xyz@yahoo.co.in"; string password="abcxyz"; MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(to); mail.From = new ...

SharePoint - Approaching Website Storage Limit Email

How can i go about changing the distribution list as well as the email text for the email that goes out to site collection admin when a site collection approaches it s size limit? Thanks for your ...

How to create an email mailing list

Im creating a coming soon page for a website im developing, and im adding an option for the user to enter their email address so we can email them when the site is up. How do I do this?

CCNet email does not include MSBuild results

We re using CCNet 1.4.4.83 but when an MSBuild task fails, we don t get the MSBuild results (i.e. missing file or whatever reason the compile failed) in the email notification. I do see the build ...

热门标签