我遇到了以下问题:当尝试发送带有作为文件附加查询结果的电子邮件时,通过执行普通查询使用sp_send_dbmail一切似乎都正常.
但是,如果将相同的代码添加到JobStep并运行作业,则会失败.
工作经历中的错误说
格式化查询时出错,可能是无效参数[SQLSTATE 42000](错误22050).步骤失败了.
但是当我注释掉引用文件的参数时,它再次开始正常工作.
exec msdb.dbo.sp_send_dbmail
@profile_name = 'profile_name',
@recipients = 'some@mail.com',
@body = 'body',
@subject = 'subj',
--Parameters that refers to attached file
@attach_query_result_as_file = 1,
@query_result_header = 0,
@query_result_no_padding = 1,
@query = 'select 1',
@query_attachment_filename = 'test.csv'
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我有一个以编程方式生成的图像,我想通过ACTION_SEND
和EXTRA_STREAM
方法作为附件发送.
但是我该怎么做?
我的第一次尝试(写入我的context.getCacheDir()
基础文件路径)似乎在Gmail预览中有效(没有图像预览,但附件文件名和图标可见),但附件从未到达收件人端.我想这与生成的文件的权限有关,但如何避免这种情况?我是否需要在这些生成的文件上设置更宽松的设置(以便Gmail活动可以访问)?应用程序的缓存文件夹甚至可以吗?
是否有另一个文件位置更适合写我的文件?我考虑了下载文件夹,但认为这对于只有在通过电子邮件发送之前才需要存在的东西才是一个尴尬的位置.
我甚至尝试过纯粹在data:image/png;base64,ABCD...
样式URI中编码我的图像.这也出现在Gmail预览中(附件图标,但没有文件名),但未导致收件人端附件.
有没有人能够通过任何方式将一次性生成的图像附加到电子邮件意图?我可能忽略了哪些选择?
有人可以帮我弄清楚为什么这会一直变回虚假?
$to = "myemail@mydomain.com";
$from = "Website <website@mydomain.com>";
$subject = "Test Attachment Email";
$separator = md5(time());
// carriage return type (we use a PHP end of line constant)
$eol = PHP_EOL;
// attachment name
$filename = "document.pdf";
//$pdfdoc is PDF generated by FPDF
$attachment = chunk_split(base64_encode($pdfdoc));
// main header
$headers = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$headers .= "This is a MIME encoded message.".$eol.$eol;
// message
$headers .= "--".$separator.$eol;
$headers …
Run Code Online (Sandbox Code Playgroud) 好的.我认为这个问题与我的rails应用程序有关,但它似乎与电子邮件附件的更深层次的工作有关.
我必须从我的rails应用程序发送一个csv文件到仓库,该仓库在我的商店中完成订单.仓库具有CSV格式,具有讽刺意味的是,CSV文件的标题行超长(1000+个字符).
当我收到测试电子邮件时,我在csv文件的标题行中得到了一个换行符,并且无法弄清楚是什么把它放在那里.然而,一些谷歌搜索终于显示了原因:附加文件的行字符限制为1000.为什么?我不知道.这看起来很荒谬,但我仍然不得不以某种方式发送这个csv文件.
我尝试手动将附件的MIME类型设置为text/csv,但这没有用.有人知道如何解决这个问题吗?
一些相关的Google搜索结果:http://www.google.com/search? client = safari&rls = en&q = csv + wrapped +990&ie = UTF-8&e = UTF-8
更新
我试过在base64中对附件进行编码,如下所示:
attachments['205.csv'] = {:data=> ActiveSupport::Base64.encode64(@string), :encoding => 'base64', :mime_type => 'text/csv'}
Run Code Online (Sandbox Code Playgroud)
这似乎没有什么不同.我通过Sparrow for Mac收到了me.com帐户的电子邮件.我将尝试使用gmail的web界面.
我想通过电子邮件发送PDF作为使用FPDF创建的附件.我的代码看起来像这样,但附件永远不会出现.
<?php
require('lib/fpdf/fpdf.php');
$pdf = new FPDF('P', 'pt', array(500,233));
$pdf->AddFont('Georgiai','','georgiai.php');
$pdf->AddPage();
$pdf->Image('lib/fpdf/giftcertificate.jpg',0,0,500);
$pdf->SetFont('georgiai','',16);
$pdf->Cell(40,10,'Hello World!');
$doc = $pdf->Output('test.pdf', 'S');
//define the receiver of the email
$to = 'myemail@example.com';
//define the subject of the email
$subject = 'Test email with attachment';
//create a boundary string. It must be unique
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: reply@test.com\r\nReply-To: …
Run Code Online (Sandbox Code Playgroud) 我经常发送或接收带有源代码附件(.c,.cpp,.h,.js等)的邮件.如果我可以在Outlook中预览这些文件会更容易,所以我不需要在另一个应用程序中打开.
优选地,预览将包括语法突出显示,类似于Visual Studio.是否有适用于Outlook的Visual Studio预览插件?
我使用Visual Studio 2010 pro和MS Office 2007 Pro +
在我的程序中,我正在编写一封电子邮件,使用安装在用户计算机上的默认电子邮件客户端软件进行发送.
我已经写了mailto地址,主题,多字体,我有几个附件要包括在内.
我几乎使用mailto和ShellExecute工作如下:
Message := 'mailto:someone@somewhere.com'
+ '?subject=This is the subjectBehold Error Report'
+ '&body=This is line 1' + '%0D%0A'
+ 'This is line 2' + '%0D%0A'
+ 'This is line 3'
+ '&Attach=c:\file1.txt';
RetVal := ShellExecute(Handle, 'open', PChar(Message), nil, nil, SW_SHOWNORMAL);
if RetVal <= 32 then
MessageDlg('Cannot find program to send e-mail.', mtWarning, [mbOK], 0);
Run Code Online (Sandbox Code Playgroud)
在Windows Vista计算机上使用Delphi 2009,这将打开Microsoft Mail"创建邮件"窗口,正确填充"收件人","主题"和"正文".但是文件没有附加.
当我研究这个时,我注意到一些评论说这种技术不适用于所有邮件客户端.然而,大多数评论都相当陈旧,因为我意识到这是一种非常古老的技术.
然后我发现Zarko Gajic说 "这种方法没问题,但是你无法以这种方式发送附件".
我看过还有Windows Simple Mail API(MAPI),但Zarko说只有最终用户拥有符合MAPI标准的电子邮件软件才有效.有关使用MAPI和Delphi的文档很好(例如使用mapi发送电子邮件),但他们都有免责声明MAPI并不总是与Windows一起安装.
此外,我真的希望在用户的默认电子邮件程序中首先显示该消息,因此他们将其作为其电子邮件记录的一部分,并且他们可以编辑它并决定是否以及何时发送它.我不确定MAPI是如何工作的,如果它会这样做.
所以我的要求是:
将电子邮件发送到用户的邮件程序中.
允许一个或多个附件.
在XP上(即XP,Vista或7)使用任何Windows机器上的所有电子邮件客户端(希望如此).
有这样的动物吗?或者也许有人知道如何使用mailto/ShellExecute技术获取附件?
大多数人做什么?
编辑:
MAPI解决方案甚至是Indy解决方案都有一些答案. …
我有一个SharePoint列表,我正在使用客户端对象模型添加新的ListItems.添加ListItems不是问题,效果很好.
现在我想添加附件.
我以下列方式使用SaveBinaryDirect:
File.SaveBinaryDirect(clientCtx, url.AbsolutePath + "/Attachments/31/" + fileName, inputStream, true);
Run Code Online (Sandbox Code Playgroud)
只要我尝试添加附件的项目已经具有通过SharePoint网站添加的附件而不使用客户端对象模型,它就没有任何问题.
当我尝试将附件添加到没有任何附件的项目时,我会收到以下错误(两者都发生但没有相同的文件 - 但这两个消息始终显示):
The remote server returned an error: (409) Conflict
The remote server returned an error: (404) Not Found
我想我可能需要先为这个项目创建附件文件夹.当我尝试以下代码时:
clientCtx.Load(ticketList.RootFolder.Folders);
clientCtx.ExecuteQuery();
clientCtx.Load(ticketList.RootFolder.Folders[1]); // 1 -> Attachment folder
clientCtx.Load(ticketList.RootFolder.Folders[1].Folders);
clientCtx.ExecuteQuery();
Folder folder = ticketList.RootFolder.Folders[1].Folders.Add("33");
clientCtx.ExecuteQuery();
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息:
Cannot create folder "Lists/Ticket System/Attachment/33"
我拥有SharePoint站点/列表的完全管理员权限.
我有什么想法可能做错了吗?
谢谢,Thorben
我发现了一个相当奇怪的问题,我想我知道如何解释; 我只是不知道如何解决它!
我有一个div#container(一个div为100%min-height(IE的高度))的页面,包含一个标题,一个"页面内容"和一个页脚.div#container的背景图像应该是固定的(不是固定位置,但background-attachment: fixed
滚动时会使图片跟随).
问题是,当固定附件添加到CSS中的background-tag时,背景图片现在位于div之外.
CSS如下:(没有background-attachment: fixed;
)
div#container {
position:relative;
width:900px;
margin:0 auto;
background-color: #ccffff;
background-image: url("pics/sign.jpg");
background-repeat: no-repeat;
background-position: right top;
height:auto !important;
height:100%;
min-height:100%;
}
Run Code Online (Sandbox Code Playgroud)
margin:0 auto;
是以div为中心!important
,第一个height:
是让IE忽略那个特定的高度标签.如果min-height: 100%
应该工作,这是必需的.
当我添加这个...
div#container {
position:relative;
width:900px;
margin:0 auto;
background-color: #ccffff;
background-image: url("pics/sign.jpg");
background-attachment: fixed; //This is what is added to the code-sample
background-repeat: no-repeat;
background-position: right top;
height:auto !important;
height:100%;
min-height:100%;
}
Run Code Online (Sandbox Code Playgroud)
......背景图片正在移动到div之外.让我解释一下:背景图像中唯一可见的部分是仍在内部,<div id="container">
但图像的一部分移动到div之外,现在看不见了.
当背景图像被修复时,背景图像被部分隐藏,移动到div之外.图像位于浏览器窗口的右上角,而不是div的右上角. …
我是Elasticsearch的新手,我在这里阅读https://www.elastic.co/guide/en/elasticsearch/plugins/master/mapper-attachments.html,在elasticsearch 5.0.0中不推荐使用mapper-attachments插件.
我现在尝试使用新的ingest-attachment插件索引pdf文件并上传附件.
到目前为止我尝试过的是
curl -H 'Content-Type: application/pdf' -XPOST localhost:9200/test/1 -d @/cygdrive/c/test/test.pdf
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}},"status":400}
Run Code Online (Sandbox Code Playgroud)
我希望pdf文件将被编入索引并上传.我究竟做错了什么?
我还测试了Elasticsearch 2.3.3,但mapper-attachments插件对此版本无效,我不想使用任何旧版本的Elasticsearch.