当我尝试将电子邮件发送到包含突出字符(é)的地址时,SmtpClient.Send()方法抛出此异常:
System.Net.Mail.SmtpException:仅为具有ASCII本地部分的电子邮件地址配置客户端或服务器:léo.xxx@example.com.
在System.Net.Mail.Mail上的System.Net.Mail.MailAddress.GetAddress(布局allowUnicode)
中的System.Net.Mail.SmtpClient.ValidateUnicodeRequirement(MailMessage ...)(MailMessage ...
)
消息的制定使我可能有一个设置,我可以激活,以使这项工作,虽然我没有找到任何关于这个主题.
我尝试了几种SMTP服务器,包括Gmail.以下是repro的相关位:
码
var msg = new MailMessage();
msg.Subject = "Test";
msg.From = new MailAddress("xxx@gmail.com");
msg.To.Add(new MailAddress("léo.yyy@gmail.com"));
new SmtpClient().Send(msg);
Run Code Online (Sandbox Code Playgroud)
的app.config
<system.net>
<mailSettings>
<smtp from="xxx@gmail.com">
<network host="smtp.gmail.com" port="587" userName="xxx@gmail.com" password="password" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
Run Code Online (Sandbox Code Playgroud) 我遇到以下CXF异常:
warning: Interceptor for {http://example.com/wsdl/esc/2011-12-12/}AmazonEC2#{http://example.com/wsdl/esc/2011-12-12/}NewDescribeImages has thrown exception, unwinding now
java.lang.NullPointerException
at org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor.handleMessage(StartBodyInterceptor.java:59)
at org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor.handleMessage(StartBodyInterceptor.java:37)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:762)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1582)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1467)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1375)
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:510)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:295)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy31.newDescribeImages(Unknown Source)
at test.App.main(App.java:62)
javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
Run Code Online (Sandbox Code Playgroud)
导致此异常的代码:
MyService ms =new MyService ();
MyServicePort port = ms.getAmazonEC2Port();
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, …
Run Code Online (Sandbox Code Playgroud) 我使用PEAR的mail和mail_mime包发送邮件,示例代码如下:
$sendStart=array();
require_once('Mail.php');
require_once('Mail/mime.php');
$sendStart['mail'] =& Mail::factory('mail');
$sendStart['mime'] = new Mail_mime("\n");
$sendStart['mime']->setHTMLBody($html);
$sendStart['headers']['Subject']=$title;
$sendStart['headers']['X-SMTPAPI']='{"category": ["MailID-XXX"]}';
$body=$sendStart['mime']->get(array(
'html_charset'=>'UTF-8',
'text_charset'=>'UTF-8',
'head_charset'=>'UTF-8'
));
//echo ($sendStart['mime']->_htmlbody); exit;
$sendStart['mail']->send('xxx@example.com',$sendStart['mime']->headers($sendStart['headers']),$body);
Run Code Online (Sandbox Code Playgroud)
通过此代码发送邮件时,我遇到了一个奇怪的问题.我在电子邮件正文中有图像,有时图像不显示.当我调试问题时,我发现.
图片网址中缺少这个问题.但是,如果我在发送行之前打印邮件(因为我在代码中注释掉),它会完美地打印出图像.
正确的图片网址: http://www.domain.com/image.png
在邮件中:http://www.domaincom/image.png
或http://www.domain.com/imagepng
......等
HTML代码的一部分,其图像如下所示:
<table cellpadding="0" cellspacing="0" border="0" class="image-table image-2" align="center" style="float:none;margin-left:auto;margin-right:auto;text-align:left;">
<tbody>
<tr>
<td class="element" style="text-align: left;height: auto;overflow: hidden;-webkit-text-size-adjust: none;">
<!--[if gte mso 9]><img alt="Placeholder Image" src="http://www.domain.com/image.png" style="outline: none; text-decoration: none; display: block; clear: none; float: none; margin-left: auto; margin-right: auto;display:none; mso-hide: none;" align="center" width="394"><![endif]--><![if !mso]><!-- --><img alt="Placeholder …
Run Code Online (Sandbox Code Playgroud) 休息端点
<jaxrs:server id="jaxrs"
address="http://127.0.0.1:8080/jaxrs">
<jaxrs:serviceBeans>
<ref component-id="service1" />
...
...
<ref component-id="serviceX" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref component-id="runtimeExceptionMapper" />
</jaxrs:providers>
</jaxrs:server>
Run Code Online (Sandbox Code Playgroud)
路线
<route id="secureBridgeRoute">
<from uri="jetty:https://0.0.0.0:443/jaxrs?sslContextParametersRef=sslContextParameters&matchOnUriPrefix=true&minThreads=8&maxThreads=16" />
<transacted ref="JTA_TRANSACTION" />
<to uri="jetty:http://127.0.0.1:8080/jaxrs?bridgeEndpoint=true&throwExceptionOnFailure=true" />
</route>
Run Code Online (Sandbox Code Playgroud)
DAO
<bean id="dao1" class="com.example.Dao1" activation="eager">
<jpa:context unitname="PU" property="entityManager" type="TRANSACTION" />
</bean>
Run Code Online (Sandbox Code Playgroud)
服务bean
<bean id="service1" class="com.example.Service1" activation="eager">
<property name="dao1" ref="dao1" />
<property name="dao2" ref="dao2" />
<tx:transaction method="*" value="Required" />
</bean>
Run Code Online (Sandbox Code Playgroud)
服务bean方法伪代码
boolean create(entity1, entity2) {
dao1.persist(entity1);
dao2.persist(entity2);
}
Run Code Online (Sandbox Code Playgroud)
当dao2持久失败时,事务没有回滚.Entity1被插入到DB中.
附加信息
1)TransactionManager定义
<reference id="platformTransactionManager" interface="org.springframework.transaction.PlatformTransactionManager" />
<bean id="JTA_TRANSACTION" class="org.apache.camel.spring.spi.SpringTransactionPolicy"> …
Run Code Online (Sandbox Code Playgroud) 我有一个分配了 /64 IPv6 的 VPS。当我尝试使用块中的一个 IP 卷曲时,这是我得到的错误:
curl --interface '2a02:c207:2010:1077::2' http://example.com
curl: (45) bind failed with errno 99: Cannot assign requested address
Run Code Online (Sandbox Code Playgroud)
我到底需要做什么来解决这个问题?以 root 身份登录时,我不应该能够在机器上使用任何 IP 吗?
基本上我只需要能够使用分配给 VPS 的任何 IPv6 进行卷曲。
请解释一下如何使用SSL(https://)从服务器下载文件.我没有在互联网上找到合适的答案.
每个人都说TIdSSLIOHandlerSocket,但我只有TIdSSLIOHandlerSocketOpenSSL.如果我使用TIdSSLIOHandlerSocketOpenSSL,我有一个错误'无法加载SSL库'.有人说它需要一个图书馆,但最不提的是它.我是否需要使用http://www.indyproject.org/sockets/SSL.EN.aspx中的库?
我在程序的文件夹中有这些DLL.根据:http://edn.embarcadero.com/article/31279 "在运行时,Indy尝试加载libeay32.dll和ssleay32.dll." 我不知道Indy试图加载DDL的位置 - >我有一个错误:'无法加载SSL库.'
procedure TForm1.FormCreate(Sender: TObject);
var UpdateMemoryStream:tmemorystream;
begin
try
UpdateMemoryStream:=TMemoryStream.Create;
try
idhttp2.Get('https://example.com/list.rar',UpdateMemoryStream); //I have: Exception class EIdOSSLCouldNotLoadSSLLibrary with message 'Could not load SSL library.'
except
on E : Exception do
begin showmessage('Error: '+E.Message);
end;
end;
UpdateMemoryStream.SaveToFile('d:\1.rar');
finally
UpdateMemoryStream.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
为什么我有这个错误?我有Delphi 2010.
我是android的新手.我有一个加载URL的Web视图.问题是,在我打开应用程序后,在加载Web视图的URL之后有一个白色屏幕,持续2-3秒.
我认为这是应用程序启动的时间.如何删除白色屏幕并显示我的Logo?我听说过闪屏,但是徽标出现1秒钟,然后再出现白色屏幕2-3秒,最后加载了网页视图.
我究竟做错了什么?在Web视图加载时,是否使用闪屏或其他方式显示徽标?
package com.exampe.dating;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.view.KeyEvent;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView mywebview = (WebView) findViewById(R.id.webview);
mywebview.loadUrl("http://www.example.com/mobile/index.php");
WebSettings webSettings = mywebview.getSettings();
webSettings.setJavaScriptEnabled(true);
mywebview.setWebViewClient(new WebViewClient());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
public boolean onKeyDown(int keyCode, …
Run Code Online (Sandbox Code Playgroud) 所以我在尝试使用PHPmailer从我的网站发送邮件时收到此错误.
SMTP错误:以下收件人失败:XXXX
我试着设置$ mail-> SMTPAuth = true; 是假但没有结果.我试图更改邮件帐户的密码,并在sendmailfile.php中更新,但仍然相同.
两天前它按预期工作,现在我不知道为什么会这样.由于没有任何错误代码,我不知道从哪里开始,因为它确实有效..
谁可能知道?
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->ContentType = 'text/html';
$mail->IsSMTP();
$mail->Host = "HOST.COM";
$mail->SMTPAuth = true;
$mail->Username = "MAIL_TO_SEND_FROM";
$mail->Password = "PASSWORD";
$mail->From = "MAIL_TO_SEND_FROM";
$mail->FromName = "NAME";
$mail->AddAddress($safeMail);
$mail->AddReplyTo("no-reply@example.COM", "No-reply");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$sub = "SUBJECT";
mail->Subject = ($sub);
Run Code Online (Sandbox Code Playgroud) 我一直在寻找答案,并尝试了许多问题.
我的脚本在我的webhost上工作正常但是当它移动到另一个专用服务器时,邮件永远不会被传递.现在我需要设置SMTP服务器,但不要正确.
使用Gmail应用程序btw.这就是代码的样子.
<?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("@",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','telephone','message');
$required = array('name','email','telephone','message');
$your_email = "xxx@example.com";
$email_subject = "New Messag: ".$_POST['subject'];
$email_content = "New message:\n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'telephone') {
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= …
Run Code Online (Sandbox Code Playgroud) 其他一切正常,我可以通过https发出SOAP和RESTful调用.但WSDL始终返回空白(错误请求).HTTP返回WSDL很好.
跟踪日志内部异常报告:
The body of the message cannot be read because it is empty.
Run Code Online (Sandbox Code Playgroud)
serviceMetaData标记已设置:
<serviceMetadata
httpGetEnabled="true"
policyVersion="Policy15"
httpsGetEnabled="true" />
Run Code Online (Sandbox Code Playgroud)
web.Config部分绑定:
<bindings>
<basicHttpBinding>
<binding name="soapBinding">
<security mode="None">
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="webBinding">
<security mode="None">
</security>
</binding>
</webHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
您会立即注意到安全模式="无"
通过ServiceHostFactory我看到要传输的模式:
ServiceHost serviceHost = new ServiceHost(service.GetType(), baseAddresses);
if (ExposeSSL(baseAddresses[0]))
{
foreach (var endpoint in serviceHost.Description.Endpoints)
{
if (endpoint.Binding is WebHttpBinding)
{
((WebHttpBinding)endpoint.Binding).Security.Mode = WebHttpSecurityMode.Transport;
endpoint.Address = new EndpointAddress(baseAddresses[0].ToString().Replace("http", "https"));
}
if (endpoint.Binding is BasicHttpBinding)
{
((BasicHttpBinding)endpoint.Binding).Security.Mode = BasicHttpSecurityMode.Transport;
endpoint.Address = …
Run Code Online (Sandbox Code Playgroud)