我有一个表格example.com/contact-us.php
就像这样(简化):
<form method="post" action="process.php" enctype="multipart/form-data">
<input type="file" name="uploaded_file" id="uploaded_file" />
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
</form>
Run Code Online (Sandbox Code Playgroud)
在我的process.php
文件中,我使用以下代码PHPMailer()
发送电子邮件:
require("phpmailer.php");
$mail = new PHPMailer();
$mail->From = me@example.com;
$mail->FromName = My name;
$mail->AddAddress(me@example.com,"John Doe");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Contact Form Submitted";
$mail->Body = "This is the body of the message.";
Run Code Online (Sandbox Code Playgroud)
电子邮件正确发送正文,但没有附件uploaded_file
.
我的问题
我需要将uploaded_file
表单中的文件附加到电子邮件中,然后发送.process.php
脚本在电子邮件中发送文件后,我不关心保存文件.
我知道我需要在AddAttachment();
某处添加(我假设在线下Body
)以便发送附件.但...
process.php
文件的顶部放入什么来拉入文件uploaded_file
?喜欢使用$_FILES['uploaded_file']
从contact-us.php页面提取文件的东西?AddAttachment();
对文件进行连接,并与邮件一起发送并在这段代码需要去?请帮忙并提供代码!谢谢!
我想在我的邮件中附上.vcf文件并通过邮件发送.但邮件收到的地址没有附件.我使用下面的代码,但代码为此,我不知道我错在哪里.
try {
String filelocation="/mnt/sdcard/contacts_sid.vcf";
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse( "file://"+filelocation));
intent.putExtra(Intent.EXTRA_TEXT, message);
intent.setData(Uri.parse("mailto:"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
activity.finish();
} catch(Exception e) {
System.out.println("is exception raises during sending mail"+e);
}
Run Code Online (Sandbox Code Playgroud) 我添加这样的附件:
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(AttachmentPath);
msg.Attachments.Add(attachment);
Run Code Online (Sandbox Code Playgroud)
但是我想把它作为一个不同的名字附加,实际的文件名很长而且令人困惑我想把它作为"file.txt"附加,是否有一种简单的方法可以做到这一点,而无需复制文件?
我正在尝试使用java和g邮件发送电子邮件我已将我的文件存储在云端,而我希望将存储的文件作为附件发送到我的邮件.
它应该将该文件添加到此邮件而不是这些文件的链接.
我怎么能发送这样的附件?
我想在电子邮件正文中添加图片.我不想将图像附加到电子邮件中,而是在电子邮件正文中添加图像.
这该怎么做?
我正在使用它.
"<img src=\"data:image/png;base64,"+convertFileTOByteEncrypt()+"\">"
Run Code Online (Sandbox Code Playgroud)
要么
"<img src=\"http://images.anandtech.com/doci/3982/HTCSurround-0134.jpg\">"
Run Code Online (Sandbox Code Playgroud)
然后图像显示如下.
作为标题,MailKit是否支持发送文件?
如果是,我该怎么办?
我正在尝试下载,然后使用Excel中的VBA在Outlook电子邮件中打开Excel电子表格附件.我怎么能够:
我还希望能够将以下内容保存为分配给各个变量的单个字符串:
虽然这可能更好地在一个单独的问题中提出/自己寻找它.
我目前的代码来自其他在线论坛,可能不是很有帮助.但是,这里有一些我一直在努力的点点滴滴:
Sub SaveAttachments()
Dim olFolder As Outlook.MAPIFolder
Dim att As Outlook.Attachment
Dim strFilePath As String
Dim fsSaveFolder As String
fsSaveFolder = "C:\test\"
strFilePath = "C:\temp\"
Set olFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
For Each msg In olFolder.Items
While msg.Attachments.Count > 0
bflag = False
If Right$(msg.Attachments(1).Filename, 3) = "msg" Then
bflag = True
msg.Attachments(1).SaveAsFile strFilePath & strTmpMsg
Set msg2 …
Run Code Online (Sandbox Code Playgroud) 我无法想象我的生活为什么它失败了......这是我得到的确切错误:
Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection
could not be established with host smtp.gmail.com [Connection refused #111]' in
/home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php:259
Stack trace: #0
/home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php(64):
Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /home/content/38/6896038/html/test/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer->initialize(Array) #2 /home/content/38/6896038/html/test/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport->start() #3 /home/content/38/6896038/html/test/contact.php(55): Swift_Mailer->send(Object(Swift_Message)) #4 {main} thrown in /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php on line 259
Run Code Online (Sandbox Code Playgroud)
我使用的代码是我从教程中获得并阅读这里的示例,这里是:
require_once 'lib/swift_required.php';
$transport = Swift_MailTransport::newInstance();
// Create the Transport the call setUsername() and setPassword()
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('email@googleappsdomain.com')
->setPassword('xxx')
;
// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
$nombre = $_POST['name']; …
Run Code Online (Sandbox Code Playgroud) 想象一下,想要在他们的网站上放置一个允许网站访问者上传文件和简单消息的用户,该消息将立即通过电子邮件发送(即,该文件未存储在服务器上,或者如果是仅暂时)作为文件附件与邮件正文中的注释.
有关详细信息,请访问http://a2zsollution.com/php-secure-e-mail/
实现这一目标的最简单方法是什么?
最简单的方面:
这几乎与以下相反:如何从PHP获取电子邮件及其附件.它几乎可以在使用PHP编译具有多个附件的电子邮件中得到解答,但它实际上并不显示代码.
我这里有一个奇怪的情况.
我正在尝试使用以下代码发送带有多个附件的电子邮件.
Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND_MULTIPLE );
// emailIntent.setType( "plain/text" );
emailIntent.setType( "application/octet-stream" );
...
....
emailIntent.putParcelableArrayListExtra( Intent.EXTRA_STREAM, uris );
Run Code Online (Sandbox Code Playgroud)
这很好用,隐式意图机制显示了很多选项,如Gmail,Skype,Messaging等.
问题是默认的Mail客户端没有显示在HTC Thunderbolt上(但适用于其他设备,包括HTC Incredible S).
如果我尝试使用发送单个附件Intent.ACTION_SEND
,则会显示默认邮件客户端.我已经尝试将内容类型设置为text/plain,appliation/octet-stream,message/rfc282等但是没有效果.
我在这里错过了什么?