标签: attachment

如何检索当前获取附件的 MIME 类型

我正在一个项目中上传一些 pdf 文件和 .doc/docx 文件。所以,我在循环中插入了一个链接附件文件并且工作正常。

但我需要获得一个特定的属性:mimetype。

所以,我需要像这样打印附件 url 和 mimetype

http://domain.com/wp-content/...file.pdf上下载文件 文件类型:pdf 或 application/pdf

有人可以帮我解决这个问题吗?

顺便说一句,我使用的是自定义主题,而不是默认的 wordpress 主题。

非常感谢。

弗拉维奥

wordpress attachment mime-types

1
推荐指数
1
解决办法
3462
查看次数

jQuery.post()如何处理Content-Disposition:attachment?

在这里略显疯狂.我正在使用jQuery.post进行Ajax调用,如下所示:

  $.post('php/print.php',{data:dS},function(res){...  },"text");
Run Code Online (Sandbox Code Playgroud)

我从print.php返回(作为测试):

header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=test.doc");

echo "<html>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">";
echo "<body>";
echo "Testing-2-3!";
echo "</body>";
echo "</html>";
Run Code Online (Sandbox Code Playgroud)

据Firebug说,数据很好,包括标题.但是如何让浏览器(在本例中为Firefox)提示用户保存附件?

谢谢.

php jquery post document attachment

1
推荐指数
1
解决办法
3860
查看次数

Powershell-从Exchange编写电子邮件脚本

我已经浏览了整个网络,无法找到我正在寻找的内容.我正在尝试编写一个Powershell(V2)脚本,该脚本使用我们的内部Exchange服务器通过电子邮件发送文件,但不需要Outlook.我有一个用于此目的的用户帐户,但我没有为其运行的服务器提供Outlook.有人可以提供一个脚本(甚至是一种方法),允许我使用Exchange邮箱发送带有指定附件的电子邮件吗?

谢谢!

email powershell exchange-server attachment

1
推荐指数
1
解决办法
1万
查看次数

如何在php中第二次发送不同的邮件时删除附件表单phpmailer

在php文件中,我需要向2个不同的id发送2个不同的电子邮件.当我使用如下所示的两个变量时,它不起作用.

require 'PHPmailer/class.phpmailer.php';

/* First Email*/

$email = new PHPMailer();
$email->From      = 'admin@mywebsite.com';
$email->FromName  = 'My Webisite';
$email->Subject   = 'Subject of first email';
$email->Body      = 'Body of the message to first person';
$email->AddAddress( 'to first person' );

$file_to_attach = 'path of the file';       
$email->AddAttachment( $file_to_attach, '' );

$email->Send();

/* Second Email*/

require 'PHPmailer/class.phpmailer.php';
$confirm = new PHPMailer();
$confirm-> From      = 'noreply@mywebsite.com';
$confirm-> FromName  = 'Admin @ MyWebsite';
$confirm-> Subject   = 'Subject of second email';
$confirm-> Body      = 'Body of second …
Run Code Online (Sandbox Code Playgroud)

php email attachment phpmailer

1
推荐指数
2
解决办法
5287
查看次数

通过 MIMEBase 将 csv 文件作为附件发送 - python

我不明白。我尝试发送带有 csv 文件作为附件的电子邮件。第一次运行脚本很好,我收到了带有 csv 文件作为附件的电子邮件。但是在运行一次后,脚本崩溃并显示一条奇怪的 Traceback 消息。

到目前为止,这是我的代码:

import smtplib
import email.utils
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email import Encoders

msg = MIMEMultipart('foo')
msg['To'] = email.utils.formataddr(('foo', 'foo@foobar.de'))
msg['From'] = email.utils.formataddr(('foo', 'foo@foo'))
msg['Subject'] = 'foo'

# Attach a file

mail_file = file('foo.csv').read()

mail_file = MIMEBase('application', 'csv')
mail_file.set_payload(mail_file)
mail_file.add_header('Content-Disposition', 'attachment', filename='foo.csv')
Encoders.encode_base64(mail_file)
msg.attach(mail_file)

# Define SMTP server

server = smtplib.SMTP('localhost')
server.set_debuglevel(True) # show communication with the server

# Send the mail

try:
    server.sendmail('foo@foo', ['foo@foobar.de'], …
Run Code Online (Sandbox Code Playgroud)

csv email attachment python-2.7 mime-types

1
推荐指数
1
解决办法
5813
查看次数

如何使用 Attach 创建新的多对多记录

好吧,我看到了一些关于此的帖子,但我根本不理解附加的概念,我有三个表:

Llistes(列表):

        $table->increments('id');
        $table->string('nom_llista');
        $table->integer('user_id')->unsigned();
    });
Run Code Online (Sandbox Code Playgroud)

康康斯(歌曲):

        $table->increments('id');
        $table->string('titol');
        $table->integer('genere_id')->unsigned();
        $table->integer('artista_id')->unsigned();
        $table->integer('album_id')->unsigned();
Run Code Online (Sandbox Code Playgroud)

数据透视表:llistes_cancons ( lists_songs)

        $table->increments('id');
        $table->integer('id_canco')->unsigned();
        $table->integer('id_llista')->unsigned();
        $table->timestamps();
Run Code Online (Sandbox Code Playgroud)

我还有另外两个课程,我认为这是正确的,但我不确定:

在 Canco.php ( Song.php ) 中:

public function llistescancons_llistes()
{
    return $this->belongsToMany('App\Llista');
}
Run Code Online (Sandbox Code Playgroud)

在 Llista.php ( List.php ) 中:

public function llistescancons_cancons()
{
    return $this->belongsToMany('App\Canco');
}
Run Code Online (Sandbox Code Playgroud)

所以,问题是我如何在我的控制器中实现一个功能,让我可以将新记录添加到数据透视表(多对多),并且如果可能有另一个功能来显示记录,我是 Laravel 的新手,这有点对我来说很难。

many-to-many record attachment eloquent laravel-5

1
推荐指数
1
解决办法
3090
查看次数

Laravel 邮件附件

如何在laravel中添加电子邮件附件?以及上面的下载链接,以及仅验证 PDF 和大小不再​​高达 2mb。对不起,我只是一个喜欢编码的学生。请帮我。

这是我的控制器代码

public function store_applier(Request $request)
{   
    $this->validate($request, [
        'nama' => 'required',
        'email' => 'required',
        'kontak' => 'required',
        'kategori'=>'required',
        'posisi' => 'required',
        'alamat' => 'required',
    ]); 

    $tambah = new appliers(); //kita buat objek yang terhubung ke table JOBS
    $tambah->nama = $request['nama'];
    $tambah->email = $request['email'];
    $tambah->kontak = $request['kontak'];
    $tambah->kategori = $request['kategori'];
    $tambah->posisi = $request['posisi'];
    $tambah->alamat = $request['alamat'];


    $file = $request->file('upload_cv');
    $fileName = $file->getClientOriginalName();
    $request->file('upload_cv')->move("cv/", $fileName);
    $tambah->upload_cv = $fileName;
    $tambah->save();

    $email = DB::table('user')->where('email');

    Mail::send('emails.welcome', [
        'email' => $request['email'],
        'HP' …
Run Code Online (Sandbox Code Playgroud)

php email attachment laravel

1
推荐指数
1
解决办法
2万
查看次数

如何在Perl中使用附件向Gmail发送邮件?

如何使用Perl向Gmail发送邮件?这是我正在尝试的:

my $mailer = Email::Send->new(
    {
        mailer      => 'SMTP::TLS',
        mailer_args => [
            Host     => 'smtp.gmail.com',
            Port     => 587,
            User     => 'xxx',
            Password => 'xxx',
        ]
    }
);

use Email::Simple::Creator;    # or other Email::

use File::Slurp;
@arrIrc = read_file("$ircFile");
my $email = Email::Simple->create(
    header => [
        From    => 'xxx',
        To      => "$configList{email}",
        Subject => "The summary of logfile $channelName",
    ],
    body => "@arrIrc",
);
Run Code Online (Sandbox Code Playgroud)

email perl gmail attachment

0
推荐指数
1
解决办法
4265
查看次数

如何从没有用户界面的iPhone应用程序发送电子邮件

我想我的应用程序能够发送带有附件的电子邮件到硬编码的收件人,而不需要用户输入,这与MessageUI框架不同.

有没有办法做到这一点?任何示例代码将不胜感激.

提前致谢.

email iphone attachment objective-c

0
推荐指数
1
解决办法
3580
查看次数

使用PHP发送附带附件的电子邮件,仅显示没有附加文件的字符

我在我的网页上遇到这个问题,我需要通过电子邮件将文件发送给某人,我遇到的问题是邮件到达时没有附件和很多奇怪的字符,我留下了我的代码:

$boundary='Datos Adjuntos';
$boundary.=" ".md5(time());
//Cabeceras del email               

$headers ="From: Example <name@example.com>\r\n";
$headers .= "Reply-To: <name@example.com>\r\n";
//   $headers .="MIME-Version: 1.0\r\n";   
$headers .="Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n\n";

$body="--". $boundary ."\n";
$body .= "Content-Type: text/html; charset=ISO-8859-1\r\n\n";

$archivo=file_get_contents($dir."/".$handle->file_dst_name);

$archivo=chunk_split(base64_encode($archivo));

//Escritura del archivo adjunto
$body .= $body .$ContenidoString. "--" .$boundary. "\n";
//Content-Type: application/msword; name=\"nombre_archivo\"\r\n
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .=  "Content-Disposition: attachment; filename=\"".$handle->file_dst_name."\"\r\n\n$archivo";

$body = $body . "--" . $boundary ."--";

Correo::Enviar("OPERACION","name@example.com", $body,$headers);
Run Code Online (Sandbox Code Playgroud)

$ContentString是电子邮件的html,我使用上传类将文件上传到服务器然后发送,我给你留下了一封我收到的电子邮件:这是其他所有的东西,比如名字和## e电子邮件的内容.

--Datos Adjuntos 1c436ca78c5925e7096267f0eae3a7d3 Content-Transfer-Encoding:base64 Content-Disposition:attachment; filename ="9cbdf187_3251_42e5_aeaa_84df343a227d_4.pdf"JVBERi0xLjQKJdP0zOEKMSAwIG9iago8PAovQ3JlYXRpb25EYXRlKEQ6MjAxMTA4MTYxNTEyNDIt MDUnMDAnKQovQ3JlYXRvcihQREZzaGFycCAxLjMuMTY4NC1nIFwod3d3LnBk

php email attachment

0
推荐指数
1
解决办法
2424
查看次数