本文整理汇总了Java中com.fsck.k9.mail.transport.SmtpTransport类的典型用法代码示例。如果您正苦于以下问题:Java SmtpTransport类的具体用法?Java SmtpTransport怎么用?Java SmtpTransport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SmtpTransport类属于com.fsck.k9.mail.transport包,在下文中一共展示了SmtpTransport类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNext
import com.fsck.k9.mail.transport.SmtpTransport; //导入依赖的package包/类
protected void onNext() {
ConnectionSecurity securityType = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
String uri;
String username = null;
String password = null;
AuthType authType = null;
if (mRequireLoginView.isChecked()) {
username = mUsernameView.getText().toString();
password = mPasswordView.getText().toString();
authType = (AuthType) mAuthTypeView.getSelectedItem();
}
String newHost = mServerView.getText().toString();
int newPort = Integer.parseInt(mPortView.getText().toString());
String type = SmtpTransport.TRANSPORT_TYPE;
ServerSettings server = new ServerSettings(type, newHost, newPort, securityType, authType, username, password);
uri = Transport.createTransportUri(server);
mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING);
mAccount.setTransportUri(uri);
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
}
示例2: getInstance
import com.fsck.k9.mail.transport.SmtpTransport; //导入依赖的package包/类
public synchronized static Transport getInstance(Context context, StoreConfig storeConfig) throws MessagingException {
String uri = storeConfig.getTransportUri();
if (uri.startsWith("smtp")) {
return new SmtpTransport(storeConfig, new DefaultTrustedSocketFactory(context));
} else if (uri.startsWith("webdav")) {
return new WebDavTransport(storeConfig);
} else {
throw new MessagingException("Unable to locate an applicable Transport for " + uri);
}
}
示例3: getInstance
import com.fsck.k9.mail.transport.SmtpTransport; //导入依赖的package包/类
public synchronized static Transport getInstance(Account account) throws MessagingException {
String uri = account.getTransportUri();
if (uri.startsWith("smtp")) {
return new SmtpTransport(account);
} else if (uri.startsWith("webdav")) {
return new WebDavTransport(account);
} else {
throw new MessagingException("Unable to locate an applicable Transport for " + uri);
}
}
示例4: decodeTransportUri
import com.fsck.k9.mail.transport.SmtpTransport; //导入依赖的package包/类
/**
* Decodes the contents of transport-specific URIs and puts them into a {@link ServerSettings}
* object.
*
* @param uri
* the transport-specific URI to decode
*
* @return A {@link ServerSettings} object holding the settings contained in the URI.
*
* @see SmtpTransport#decodeUri(String)
* @see WebDavTransport#decodeUri(String)
*/
public static ServerSettings decodeTransportUri(String uri) {
if (uri.startsWith("smtp")) {
return SmtpTransport.decodeUri(uri);
} else if (uri.startsWith("webdav")) {
return WebDavTransport.decodeUri(uri);
} else {
throw new IllegalArgumentException("Not a valid transport URI");
}
}
示例5: createTransportUri
import com.fsck.k9.mail.transport.SmtpTransport; //导入依赖的package包/类
/**
* Creates a transport URI from the information supplied in the {@link ServerSettings} object.
*
* @param server
* The {@link ServerSettings} object that holds the server settings.
*
* @return A transport URI that holds the same information as the {@code server} parameter.
*
* @see SmtpTransport#createUri(ServerSettings)
* @see WebDavTransport#createUri(ServerSettings)
*/
public static String createTransportUri(ServerSettings server) {
if (Type.SMTP == server.type) {
return SmtpTransport.createUri(server);
} else if (Type.WebDAV == server.type) {
return WebDavTransport.createUri(server);
} else {
throw new IllegalArgumentException("Not a valid transport URI");
}
}
示例6: createTransportUri
import com.fsck.k9.mail.transport.SmtpTransport; //导入依赖的package包/类
/**
* Creates a transport URI from the information supplied in the {@link ServerSettings} object.
*
* @param server
* The {@link ServerSettings} object that holds the server settings.
*
* @return A transport URI that holds the same information as the {@code server} parameter.
*
* @see SmtpTransport#createUri(ServerSettings)
* @see WebDavTransport#createUri(ServerSettings)
*/
public static String createTransportUri(ServerSettings server) {
if (SmtpTransport.TRANSPORT_TYPE.equals(server.type)) {
return SmtpTransport.createUri(server);
} else if (WebDavTransport.TRANSPORT_TYPE.equals(server.type)) {
return WebDavTransport.createUri(server);
} else {
throw new IllegalArgumentException("Not a valid transport URI");
}
}