hi all i have got a php code which sends attachments via mail..... Please help me how to send the file parameters to the php via http service send method.... i am placing the php and flex codes here please help Sad
PHP code
<?php
$to = 'somemail@mail. com';
$from = $_POST[email];
$name = $_POST["name"];
$subject = $_POST["title"];
$emailMessage = $_POST["message"];
$message = "\nFrom: $name\nEmail Address: $frommail\nCont act Number: $phone\n\n $emailMessage";
$message = StripSlashes($m essage);
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $frommail";
if (is_uploaded_fi le($fileatt)) {
$file = fopen($fileatt, 'rb');
$data = fread($file,fil esize($fileatt) );
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Bo undary_x{$semi_ rand}x";
$headers .= "MIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mi me_boundary}\"" ;
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary }\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
$data = chunk_split(bas e64_encode($dat a));
$message .= "--{$mime_boundary }\n" .
"Content-Type: {$fileatt_type} ;\n" .
" name=\"{$fileat t_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary }--\n";
}else echo "File error! ";
mail($to, $subject, $message,$heade rs);
?>
Flex code...
<?xml version="1.0" encoding="utf-8"?>
<mx:Applicati on xmlns:mx="http://www.adobe.com/2006/mxml" viewSourceURL=" srcview/index.html" creationComplet e="init();">
<mx:HTTPServi ce id="httpService " url="http://jibysubhash.x10 hosting.com/jibysk/sendmail.php" method="POST">
<mx:request >
<name>{txtname. text}</name>
<email>{txtemai l.text}</email>
<phone>{txtphmo .text}</phone>
<title>{txtpost .text}</title>
<message>{txtco ver.text}</message>
</mx:request>
</mx:HTTPService>
<mx:Script>
<![CDATA[
private var file:FileRefere nce = new FileReference() ;
private function init():void
{
file.addEventLi stener(Event.SE LECT, selectHandler);
}
private function selectHandler(e vent:Event):voi d
{
}
private function browse(event:Mo useEvent):void
{
var filefilter:File Filter = new FileFilter("Res ume Files", "*.zip;*.doc;*. pdf;*.txt;*.rar ;*.docx");
file.browse([filefilter]);
}
]]>
</mx:Script>
<mx:Panel id="panel1" width="691" height="665" layout="absolut e" title="Apply for the job" >
<mx:Form x="0" y="0">
<mx:FormItem fontWeight="bol d" color="#000000" id="nam" label="Name : ">
<mx:TextInput width="354" height="20" id="txtname" />
</mx:FormItem>
<mx:FormItem fontWeight="bol d" color="#000000" id="mail" label="Email : ">
<mx:TextInput width="354" height="20" id="txtemail" />
</mx:FormItem>
<mx:FormItem fontWeight="bol d" color="#000000" id="phone" label="Phone/mobile : ">
<mx:TextInput width="354" height="20" id="txtphmo"/>
</mx:FormItem>
<mx:FormItem fontWeight="bol d" color="#000000" id="post" label="Post applied : ">
<mx:TextInput width="477" height="20" enabled="false" editable="false " id="txtpost" text="test mail"/>
</mx:FormItem>
<mx:FormItem fontWeight="bol d" color="#000000" id="upload" label="Upload resume : ">
<mx:Button label="Browse" id="bro" click="browse(e vent);"/>
</mx:FormItem>
<mx:FormItem fontWeight="bol d" color="#000000" id="cover" label="Cover Letter : ">
<mx:TextArea width="507" height="350" id="txtcover"/>
</mx:FormItem>
<mx:FormItem label=" " >
<mx:Button label="Send" id="applynow" click="httpServ ice.send();" />
</mx:FormItem>
</mx:Form>
<mx:Label x="210" y="125" text=" " maxWidth="300" id="statuss"/>
</mx:Panel>
</mx:Application>
0 5372 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Wald |
last post by:
Hello group,
I've got a script here that sends emails with an attachment to
an email address that is retrieved from an html form. The
email sending code is include below.
The problem: when sending the email to certain email servers,
the attachment section of the email gets removed and I end up
with an attachment of zero kb. Other servers do accept the
attachment as expected.
|
by: Leon |
last post by:
I am trying to send an email with an attachment.
The problem is the attachment is stored in db where I have created a
longblob field that contains the file so I have no idea how to specify
the file path when I want to send an email.
I have tried "" and "/" that didn't work.
Any help?
My code is
------------------------------------------------------------------------
|
by: a c s |
last post by:
Hi there, my problem is as follows:
When emailing a file using PHP 4.0.6, the attachment received is an
empty "attachment.txt" file instead of the actual file I attached.
Any suggestions why this might be? (php from a kindly newbie site enclosed)
Many thanks, Alan.
|
by: abracad |
last post by:
I'd like to add a form that will email a file attachment to me.
Can anyone recommend a decent free script?
Thanks
|
by: phatnugs420 |
last post by:
Hi all, i've been struggling with creating a form that lets you add an
attachment and the attachment is sent via email.. I was wondering if
recieving attachments in an md5 form is the only way to do this.. It's
all i've found in my searching. All my attachments are going to be
..gifs or .jpegs... Thanks in advance.
below is the code:
<?php
| |
by: GD |
last post by:
Hi,
An intranet application, with a SMTP mail function that lets users to attach
files with emails by selecting files in their local computers (through a
file browser component), works perfect on my local machine. However, after
deployment to a server that has Windows 2003 Sever installed, the mail
function is able to attach the file created by the application. However,
when users attach some files selected from their local machines, it...
|
by: theWizard1 |
last post by:
The following sends my email, but the attachment is empty. The attachment
should contain the data that is in the string that was created from the
xmlReader.
I have a stored procedure written using For XML explicit, and it returns an
xml reader. Then the following:
xmlRdr.MoveToContent();
string myTemp = xmlRdr.ReadOuterXml();
|
by: deepaks85 |
last post by:
Dear Sir,
I have created a simple request form which will be mailed to me.
Now I want to attach files and send it through that request form.
For this I am using the following script:
<?php
function mail_attachment ($from , $to, $subject, $message, $attachment){
|
by: deepaks85 |
last post by:
Dear All,
I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the code for attachment, I am not able to send anything. I get blank email.
Can you please help me on this?
Here is the html form:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |