Mail form with attachement & thank you - popup window


 
Thread Tools Search this Thread
Top Forums Programming Mail form with attachement & thank you - popup window
# 1  
Old 08-19-2011
Mail form with attachement & thank you - popup window

Dear Sir,

I have a mail form ( file name: sendresults ) in php. This php code supports the sending all text of the checkboxes of Register Page of a website. But it does't send attachement ( word, excel, jpg, image, etc. )

Now , I want to add the attachement code and a javascript of "thank you" pop-up window in the script I am using.

My code is as under:
Code:
<?php
 //--------------------------Set these paramaters--------------------------
 
// Subject of email sent to you.
 $subject = 'Test mail'; 

// Your email address. This is where the form information will be sent. 
//$emailadd = 'career@icfa.co.in'; 
$emailadd = 'basu.biswas@gmail.com';

// Where to redirect after form is processed. 
$url = 'http://www.icfa.co.in/register.php'; 

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
 $req = '1'; 

// --------------------------Do not edit below this line--------------------------
 $text = "Results from form:\n\n"; 
$space = ' ';
 $line = '
 ';
 foreach ($_POST as $key => $value)
 {
 if ($req == '1')
 {
 if ($value == '')
 {echo "$key is empty";die;}
 }
 $j = strlen($key);
 if ($j >= 20)
 {echo "Name of form element $key cannot be longer than 20 characters";die;}
 $j = 20 - $j;
 for ($i = 1; $i <= $j; $i++)
 {$space .= ' ';}
 $value = str_replace('\n', "$line", $value);
 $conc = "{$key}:$space{$value}$line";
 $text .= $conc;
 $space = ' ';
 }
 mail($emailadd, $subject, $text, $attachement, 'From: '.$emailadd.'');
 echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
 // send the message 

 // mail("$to_name <$to_email>", $subject, $message, $headers);  

if (
mail("$to_name <$to_email>", $subject, $message, $headers);  
) {
  echo '<p>Send successfully!</p>';
} else {
  echo '<p>Bah!</p>';
}
  print "Mail sent.  Thank you for using ICFa web Mailer."; 
    
  echo '("<script language = 'javascript'>window.alert('Mail sent Successfully !')</script>")';
 ?>

pl. help with attachement code of any file and a javascript of "thank you" pop-up window.

thanks in adv.

roy

Last edited by Scott; 08-19-2011 at 09:27 AM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Web Development

Attaching " Thank You " pop-up window in php form mail code

Dear Sir, I have got a php mail form code. Using this code, I want to use the JavaScript for " Thank You " pop-up window in the php form mail code. Where do I add the pop-up JavaScript for "thank you" ? My code is as follows: <?php //--------------------------Set these... (1 Reply)
Discussion started by: swapan
1 Replies

2. Web Development

Attachement Form Mail in php

Dear Sir, I have used a php form mail code in a website. The problem I am facing is: the text in mail body is getting injected to a configured yahoo mail ID, but no attachement file. I need the attachement to go to the configured yahoo mail ID. The code I have used : <?php ... (1 Reply)
Discussion started by: swapan
1 Replies

3. Shell Programming and Scripting

sending attachement in mail

Hi , I am using the below code to send mail through a script which run as a cron job. msgdate=`date +"%a, %e %Y %T %z"` daemail=$(cat <<! From: $from To: $emailtarget Subject: $subject Mime-Version: 1.0 Content-Type: multipart/mixed; Content-Disposition: inline $priority $CONTENT !)... (2 Replies)
Discussion started by: ahamed
2 Replies

4. Shell Programming and Scripting

attachement through mail command

Can't attach text files to 'mail' command. I dont have mutt or mailx to use on my server. so i have to use mail command any help would be great. Regards, Kiran (1 Reply)
Discussion started by: dddkiran
1 Replies

5. Shell Programming and Scripting

Writing an annoying popup window

Hi, I work for Xerox. As a new guy, I was recently pranked by the resident Solaris guru.:cool: This is a celebrated event. I must now prank back in an equally flawless fashion. I wish to get back to him by writing a script that will generate an annoying popup randomly, a small window that... (1 Reply)
Discussion started by: orchus
1 Replies

6. UNIX for Advanced & Expert Users

How to read mail attachement

I want to read attachements sent to unix mail id and save the attachement in folder. I may receive the mails from different mail clients(outlook, lotus ..etc). Attachements are in CSV(comma saperate) format. Let me know the shell script code for this. Regards, Venkat (1 Reply)
Discussion started by: svenkatareddy
1 Replies

7. Shell Programming and Scripting

query about Attachement in mail

Hi All, I have general query that ...in my script i used uuencode option like below. cd /location (cat test.txt uuencode test.csv test.csv ) | mail -s "test mail" "mail_id" but whenever i run the above command its giving error like below ./testscript.sh: uuencode not found: ... (1 Reply)
Discussion started by: Shahul
1 Replies

8. Shell Programming and Scripting

How to send Mail with Attachement

Hi Can somebody help me in wirting shell script in the following way.Desperately i have poseted this.. 1.How can I connect to Oracle(Sqlplus) from UNIX. 2.After connecting to it I have to execute an oracle proceudure.. 3.Execution of the procedure will give some set of rows.. 4.The set of... (6 Replies)
Discussion started by: chgopi
6 Replies

9. UNIX for Dummies Questions & Answers

Send a mail with an attachement of a file

I wanted to try sending a mail with an attachement at command prompt in unix. Some one please advise that how we can do it ? Thanks, :) (2 Replies)
Discussion started by: gaddeg
2 Replies
Login or Register to Ask a Question