473,770 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending PopUp code on the body of an email from a script

30 New Member
Hello:

I need to send a bit of HTML and Javascrpt on the body of an email from my perl script in order to have the recipient get a link that will openup a new window with a PopUp.

For some reason instead of receiving the email with the HTML showing a link that will open up my PopUp... Im getting all the HTML tags and javasacript code printed on my email.

What am I doing wrong..??

Here is the code:

Expand|Select|Wrap|Line Numbers
  1. $To_Email = '123@yahoo.com'; 
  2. $From_Email = 'info@myemail.com'; 
  3. $Email_Subject = 'TEST SEND ATTACHMENT (3)'; 
  4. $Email_Body    = 'Here u can put whatever text msg meeds to be sent in the mail!!!';
  5.  
  6. $html_attachment_text = "<html>\n";
  7. $html_attachment_text .= "<body bgcolor=gray><script>\n";
  8. $html_attachment_text .= "function Loging_Pop_Up() {\n";
  9. $html_attachment_text .= "var w = window.open(\"Loging_Form.pl?URL=$URL\",\"smallwin\",\"width=800,height=600,status=no,resizeable=yes, scrollbars=yes\");{\n";
  10. $html_attachment_text .= "}\n ";
  11. $html_attachment_text .= "</script>\n";
  12. $html_attachment_text .= "<b><font color=red>This is test line1</font><br><br>\n";
  13. $html_attachment_text .= "<font color=white>This is where you can put your html template, i.e. whatever will be in string html_attachment_text will be sent as html attrachment with the mail.<br></font>\n ";
  14. $html_attachment_text .= "<A HREF=\"http://www.altavista.com\" onClick=\"Loging_Pop_Up(); return false;\">[Link to Altavista]</A>\n";
  15. $html_attachment_text .= "</body>\n";
  16. $html_attachment_text .= "</html>\n";
  17.  
  18.  
  19. &sendemail($User_Email, $Admin_Email, "$Email_Subject", "$Email_Body", "$html_attachment_text");
The following code is the subroutine that handles the email sending
Expand|Select|Wrap|Line Numbers
  1. sub sendemail {
  2. $Mail_Program = '/usr/sbin/sendmail -t';    
  3.         my ($to,$from,$subject,$message,$attachment) = @_;
  4.         my $boundary = "xxxxx".time()."xxxxx";
  5.  
  6.                    open MAIL, "|$Mail_Program";
  7.     print MAIL "To: $to\n";
  8.     print MAIL "From: $from\n";
  9.     print MAIL "MIME-Version: 1.0\n";
  10.     print MAIL "Content-Type: multipart/mixed;";
  11.     print MAIL " boundary=\"$boundary\"\n";
  12.     print MAIL "Subject: $subject\n\n";
  13.  
  14.     print MAIL "--$boundary\n";
  15.     print MAIL "Content-Type: text/plain; charset=utf-8\n";
  16.     print MAIL "Content-Transfer-Encoding: 8bit\n\n";
  17.     print MAIL "$message\n";
  18.  
  19.     print MAIL "--$boundary\n";
  20.     print MAIL "Content-Type: text/html; charset=utf-8\n";
  21.     print MAIL "Content-Transfer-Encoding: 8bit\n\n";        
  22.     print MAIL "$attachment";
  23.     print MAIL "--$boundary--";
  24.  
  25.     close MAIL;        
  26. }
If you know of a better approach to accomplish the same thing I would appreciat it

Thanx
VirtualWeb
Nov 18 '08 #1
3 2711
eWish
971 Recognized Expert Contributor
The email will have to have the proper headers, currently you are using both text/html and text/plain. Try removing the text/plain portion of the header sent.

Your code looks like it could be reduced. If I get time later I will look at your code again.

--Kevin
Nov 18 '08 #2
virtualweb
30 New Member
Kevin:
Your suggestion worked.. thank you


VirtualWeb
Dec 10 '08 #3
KevinADC
4,059 Recognized Expert Specialist
You're welcome.

Regards,
Kevin

:)
Dec 10 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1889
by: Sol Linderstein | last post by:
Hi, I'm writing a CGI application and here's what I'm stuck with. There are some text boxes in an html form that I want to validate. The validation needs to happen on the server side because the data to validate against is inside a mysql database residing on the server. I want to present the user with a popup only if the validation fails. Ideally the user doesn't even know the validation is happening unless it fails. He just moves from...
2
2220
by: maxrawson | last post by:
Greetings all: I have an asp.net application that is coded mainly in vb.net. I have successfully cut and pasted some javascript into my application that mimicks the datetime picker control in vb. I wanted to try to use that same code for another popup style window that displays a list of airport codes in a datagrid. The desired results would be that when an airport code (the datagrid's key field) is clicked the value would write back...
3
1993
by: ypress | last post by:
Hi. I have a page that contains this simple function: <script language="javascript"> function openPop(url, name, w, h) { var features = ""; features += "scrollbars=no,"; features += "menubar=no,"; features += "resizable=no,";
2
3191
by: skim1114 | last post by:
I have this code in my popup window, which works perfectly except that I need it to display a new title for every image. Here the popup window code: <HTML> <HEAD> <TITLE>DETAIL</TITLE> <script language='javascript'> var temp=self.location.href.split("?"); var picUrl = (temp.length>1)?temp:"";
2
3587
by: VMI | last post by:
I have a LinkButton_search on my Page1.aspx that opens up a popup page called popup.aspx. I do this with LinkButton.Attributes.Add() on the Page_Load of Page1.aspx. How can I add server-side code to LinkButton_search_Click() so that the code in there runs before opening the popup window? The problem is that I fill a Session variable when I click on the button that will then be used in the Page_Load of my Popup window. So basically this is...
3
4723
by: simora | last post by:
Hi: Need some working sample code to post hidden form data from a php page to a new popup window. 540 x 500 centered. The popup that I'm calling already is formatted and has a TITLE:web-2007.php so what I need to do is to write the values from the PHP page to that popup in specific places. Some of the hidden values are also like this format; <input type="hidden" name="handling" value="<?php echo $_POST;
3
7368
by: Jimmy | last post by:
It is also possible for popup window to call function in main window by using the opener property. Will "opener.someFunctionInMain(param1, param2)" in the popup window work? It's possible for main window to call function in the popup window, right? The following is a sample code (close popup window causes to show alert window) which doesn't seems to work. Can anyone see the problem? // main
2
3267
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully validated my HTML and CSS code. 1. When I clear cache and refresh my webpage, it takes 3 tries before the popup window displays - I click on the button once, a white window the size of my webpage displays. I close it and click on the button again (for...
2
3763
by: lstanikmas | last post by:
Hi, I'm validating a form with this ASP but receiving some blank email responses; does anyone see anything wrong with it?: function isFormVarExcluded(thisForm, strToCheck) { var strExcludeVars = thisForm.elements.value; var arrExcludeVars = strExcludeVars.split(","); for (var j=0; j<arrExcludeVars.length; j++) { if (arrExcludeVars == strToCheck) return true;
0
9617
marktang
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...
0
9453
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,...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
jinu1996
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...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
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...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
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...
3
2849
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.