Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASPmail server component woes

Posted on 2001-08-04
12
Medium Priority
?
520 Views
Last Modified: 2012-06-21
Hi,

I'm trying to set up a secure ordering system for my site, using the ASPmail server component to send the orders encrypted using PGP.

I have never used ASPmail before and am having a few problems getting it to work properly.

I can use it to send simple email, no problem.  However, when I try to extract the body text from a file, I simply get a blank email.  No errors are produced, the email is sent without any problems.  It's just blank.

The code I'm using is below.

Once I have sorted out the GetBodyTextFromFile problem, I'm probably going to need help getting the PHP bit to work...

Does anyone have any ideas?

Justin


----------------------------------------------------
<%@ LANGUAGE = JScript %>

<html>
<head><title>ASP Mapppppiler Test</title><head>
<body>
<H3>ASP Mailer Test</H3>


<%
  var Mailer = Server.CreateObject("SMTPsvg.Mailer");
  Mailer.FromName = "test FromName";
  Mailer.FromAddress = "justin@petszaft.co.uk";
  Mailer.RemoteHost = "mail.petszaft.co.uk";
  Mailer.AddRecipient("Justin", "justin@jtp.dircon.co.uk");
  Mailer.Subject = "test Subject";
//  Mailer.BodyText = "test BodyText";

//  Mailer.PGPPath = "pgp.exe";
//  Mailer.PGPParams = "+batchmode -a -e -t D:\websites\petsza\www\PHPtest.txt mstrmalt@masterofmalt.co.uk";

  if (Mailer.GetBodyTextFromFile("PHPtest.txt", false, false)) {
    if (Mailer.SendMail()) {
      Response.Write("<p>Mail sent...");
      Response.Write("\nMailer.Response: " + Mailer.Response);
    }
    else {
      Response.Write("<p>Mail failure. Check mail host server name and tcp/ip connection...");
      Response.Write("\nMailer.Response: " + Mailer.Response);
    }
  }
  else {
    Response.Write("<h2 align=center>Error: Failure with encryption or with file access...</h2>");
    Response.Write("\nMailer.Response: " + Mailer.Response);
  }

Response.Write("<br>Mailer.Response2: " + Mailer.Response);

%>

</body>
</html>
0
Comment
Question by:jtp101
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
12 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6351538
I think, but am not sure, that you need to pass the whole path to the file:

if (Mailer.GetBodyTextFromFile(Server.MapPath("PHPtest.txt"), false, false))
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6351539
Assuming that Server.MapPath is also available in JScript...

regards,
CJ
0
 

Author Comment

by:jtp101
ID: 6351719
Tried your suggestion, but it had no effect.

Any other ideas?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 22

Accepted Solution

by:
CJ_S earned 200 total points
ID: 6351903
Try to do a
Mailer.GetBodyTextFromFile(Server.MapPath("PHPtest.txt"), false, false);
Response.Write(Mailer.Body);

Does it give you the body of phptest.txt?

Regards,
CJ
0
 

Author Comment

by:jtp101
ID: 6353609
I get the following output:

--------------------------------------------------
ASP Mailer Test
Mail sent...
Mailer.Response:
Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/pgpmail3.asp, line 36
--------------------------------------------------

do you know where I can find documentation on the ASPmail object model?
0
 

Author Comment

by:jtp101
ID: 6374043
Hi again CJ,

I have made a bit of a cockup, I managed to get the name of the file wrong!

It should have been PGPtest.txt rather than PHPtest.txt.

Sorry.


I am now having problems getting PGP to a file to encrypt a text file that I can load up as body text.

The encryption key I'm using has been registered with PGP on the server.

The code I'm using is below:

What am I doing wrong?

Justin

--------------------------------------------------

<%@ LANGUAGE = JScript %>

<html>
<head><title>ASPMail Test</title><head>
<body>
<H3>ASP Mailer Test3</H3>


<%
  var Mailer = Server.CreateObject("SMTPsvg.Mailer");
  Mailer.FromName = "test FromName";
  Mailer.FromAddress = "justin@petszaft.co.uk";
  Mailer.RemoteHost = "mail.petszaft.co.uk";
  Mailer.AddRecipient("Justin", "justin@jtp.dircon.co.uk");
  Mailer.Subject = "test Subject";
  Mailer.BodyText = "--- TEST3 ---";
  Mailer.PGPPath = "c:\pgp\pgp.exe";
  Mailer.PGPParams = "+batchmode -a -e -t " + Server.MapPath("PGPtest.txt.asc") + " secureordersfromsite@masterofmalt.com";
  Mailer.GetBodyTextFromFile(Server.MapPath("PGPtest.txt"), false, false);
  Mailer.SendMail();
%>

</body>
</html>
0
 

Author Comment

by:jtp101
ID: 6388020
I have solved my problem by using a combination of the ASPMail to send the mail and NSDPGP to do the encrypting.

I would still be happy to award the points for this question to anyone who knows why the code using just ASPMail didn't work, or can show a working example of sending encrypted email using just ASPMail.

Justin
0
 

Author Comment

by:jtp101
ID: 6388025
I have solved my problem by using a combination of the ASPMail to send the mail and NSDPGP to do the encrypting.

I would still be happy to award the points for this question to anyone who knows why the code using just ASPMail didn't work, or can show a working example of sending encrypted email using just ASPMail.

Justin
0
 

Author Comment

by:jtp101
ID: 6388028
I have solved my problem by using a combination of the ASPMail to send the mail and NSDPGP to do the encrypting.

I would still be happy to award the points for this question to anyone who knows why the code using just ASPMail didn't work, or can show a working example of sending encrypted email using just ASPMail.

Justin
0
 

Expert Comment

by:Micropage
ID: 6963075
hey jtp101 how did u work out the crypting thing with nsdpgp?? and what is nsdpgp.

I am working on aspmail and pgp but cant get it to work eighter. can u help me out?
0
 

Author Comment

by:jtp101
ID: 7048671
Hi  Micropage,

Sorry to take so long to reply.  You have probably solved your problem by now, but if you haven't then let me know and I will explain my solution.

Cheers,

Justin
0
 

Expert Comment

by:Micropage
ID: 7134188
no I had to give it up, but i would like to know how you did, and what you did.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question