Information: Forum is in read-only mode
For details and other support options see https://www.adiscon.com/news/support-forum-set-to-read-only-mode/

Attachment

Support, Questions and Discussions on SimpleMail

Moderator: alorbach

Google Ads


Attachment

Postby zetafire » Sun Apr 06, 2003 12:52 pm

I have just download the programme for testing, may i know where can i find all the sub-object/method details as i need to use attachfile method
zetafire
 

Postby rgerhards » Mon Apr 07, 2003 10:27 am

Please have a look at

http://www.simplemail.adiscon.com/en/Manual/manual.htm#AttachFile.

HTH
Rainer Gerhards
Adiscon
rgerhards
Site Admin
 
Posts: 3807
Joined: Thu Feb 13, 2003 11:57 am

Postby zetafire » Wed Apr 09, 2003 3:20 pm

Hi,

Sorry i'm really new to script, may i know how to call the above method?
zetafire
 

Postby rgerhards » Wed Apr 09, 2003 4:32 pm

set o = Server.CreateObject("ADISCON.SimpleMail.1") ' create mailer!

o.MailServer = "127.0.0.1"
o.Sender = "Test@Test.com"
o.AttachFile "c:\test.txt", "test.txt"
o.Recipient = "SomeOne@SomeCompany.Com"
o.Subject = "My first SimpleMail mail"
o.MessageText = "Line 1" + Chr(13) + Chr(10) + "Line 2"
' of course, this could also be somethig like this:
' o.MessageText = Request("strMessage")

call o.Send

set o = Nothing
rgerhards
Site Admin
 
Posts: 3807
Joined: Thu Feb 13, 2003 11:57 am

Postby zetafire » Wed Apr 09, 2003 4:59 pm

rgerhards wrote:set o = Server.CreateObject("ADISCON.SimpleMail.1") ' create mailer!

o.MailServer = "127.0.0.1"
o.Sender = "Test@Test.com"
o.AttachFile "c:\test.txt", "test.txt"
o.Recipient = "SomeOne@SomeCompany.Com"
o.Subject = "My first SimpleMail mail"
o.MessageText = "Line 1" + Chr(13) + Chr(10) + "Line 2"
' of course, this could also be somethig like this:
' o.MessageText = Request("strMessage")

call o.Send

set o = Nothing


Hi, Thanks for your reply. But it still doesn't work. Could it be due to i'm using the unregistered version. In fact i try to use the "Simple Test" in SimpleMail Client windows interface, it also doesn't show the attachment. Anyway Thanks again.
zetafire
 

Postby rgerhards » Wed Apr 09, 2003 5:00 pm

Could you please post the snippet of what you are doing. This may allow us to provide a more intelligent answer.

Thanks,
Rainer
rgerhards
Site Admin
 
Posts: 3807
Joined: Thu Feb 13, 2003 11:57 am

Postby Guest » Wed Apr 09, 2003 5:04 pm

rgerhards wrote:Could you please post the snippet of what you are doing. This may allow us to provide a more intelligent answer.

Thanks,
Rainer


Hi, Actually i'm just still trying out the send mail feature, and i follow your code completely(except change the sender and receiver address)
Guest
 

Postby rgerhards » Wed Apr 09, 2003 5:11 pm

OK, that clarifies. Maybe a stupid question, but: did you make sure that "c:\test.txt" exists and is accessible? If not, please create such a file with notepad.

Please let us know the outcome.

Rainer
rgerhards
Site Admin
 
Posts: 3807
Joined: Thu Feb 13, 2003 11:57 am

Postby ZetaFire » Wed Apr 09, 2003 5:27 pm

rgerhards wrote:OK, that clarifies. Maybe a stupid question, but: did you make sure that "c:\test.txt" exists and is accessible? If not, please create such a file with notepad.

Please let us know the outcome.

Rainer


Hi,

Yes, the file is there and never set any permission.

Below is the full code for the script.

Thanks for your patience.

' Sample code for monitoring windows disk space
'
' This script reports the drive usage of all fixed drives on the system
' it is run. The report will be sent via plain text email to a specified
' recipient address (see last line in file).
'
' This sample can be used in a production environment to set up an
' unattended disk utilization report system.
'
' For more information contact Adiscon at http://www.adiscon.com/
'
' Support for SimpleMail is available at http://www.simplemail.adiscon.com/
'

' Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5

' general constants
Const MailServer = "mail.singnet.com.sg" ' Mail Server to use for SimpleMail
Const MailServerPort = "25" ' SMTP Port used at Mail server (25 is default)


' Send a mail message
Sub SendMail(Sender, Recipient, Subject, Message)
set o = WScript.CreateObject("Adiscon.SimpleMail.1")
o.MailServer = MailServer
o.Port = MailServerPort
o.Sender = Sender
o.AttachFile "C:\test.txt", "test.txt"
o.Recipient = Recipient
o.Subject = Subject
o.MessageText = Message
a = o.SendEx

' we do not check the return state here - it wouldn't help if we detect
' an error! This script is intended to run in the background, so there is
' little we can do.
End Sub


' get current computer name (from system environment variables)
Function GetCurrentComputerName
set oWsh = WScript.CreateObject("WScript.Shell")
set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
End Function

'====================================================================================
' Begin main code
'====================================================================================
str = ""

set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives
strComputerName = GetCurrentComputerName ' get name only once for performance reasons

for each oDrive in oDrives
Select case oDrive.DriveType
Case Fixed
str = str & strComputerName & "," & oDrive.DriveLetter & "," & oDrive.TotalSize & "," & oDrive.FreeSpace & vbcrlf
End Select
next

SendMail "sinkingspace@hotmail.com", "sinkingspace@hotmail.com", "Drive Space Report", str
ZetaFire
 

Postby lkoch » Thu Apr 10, 2003 4:39 pm

Hi.

I modified the code so that you see the results of the SendEx-Action:
Now you'll see one Messageboxes with the result(a), as well as one with the SMTP-Errorcode(o.LastStatus). That information might be useful.

'Sample code for monitoring windows disk space
'
' This script reports the drive usage of all fixed drives on the system
' it is run. The report will be sent via plain text email to a specified
' recipient address (see last line in file).
'
' This sample can be used in a production environment to set up an
' unattended disk utilization report system.
'
' For more information contact Adiscon at http://www.adiscon.com/
'
' Support for SimpleMail is available at http://www.simplemail.adiscon.com/
'
' Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
' general constants
Const MailServer = "mail.singnet.com.sg" ' Mail Server to use for SimpleMail
Const MailServerPort = "25" ' SMTP Port used at Mail server (25 is default)
' Send a mail message
Sub SendMail(Sender, Recipient, Subject, Message)
set o = WScript.CreateObject("Adiscon.SimpleMail.1")
o.MailServer = MailServer
o.Port = MailServerPort
o.Sender = Sender
o.AttachFile "C:\test.txt", "test.txt"
o.Recipient = Recipient
o.Subject = Subject
o.MessageText = Message
a = o.SendEx
msgbox "a: "& a
If a = -1 then msgbox "LastStatus: "& o.LastStatus

' we do not check the return state here - it wouldn't help if we detect
' an error! This script is intended to run in the background, so there is
' little we can do.
End Sub
' get current computer name (from system environment variables)
Function GetCurrentComputerName
set oWsh = WScript.CreateObject("WScript.Shell")
set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
End Function
'====================================================================================
' Begin main code
'====================================================================================
str = ""
set oFs = WScript.CreateObject("Scripting.FileSystemObject")
set oDrives = oFs.Drives
strComputerName = GetCurrentComputerName ' get name only once for performance reasons
for each oDrive in oDrives
Select case oDrive.DriveType
Case Fixed
str = str & strComputerName & "," & oDrive.DriveLetter & "," & oDrive.TotalSize & "," & oDrive.FreeSpace & vbcrlf
End Select
next
SendMail "sinkingspace@hotmail.com", "sinkingspace@hotmail.com", "Drive Space Report", Str
lkoch
 

Postby ZetaFire » Sat Apr 12, 2003 4:50 pm

Hi,

Thanks for your help. After i run the script, it return value 0 for a

Does it means everything works fine?

Btw can you help to run the script to see whether file can be attach?
ZetaFire
 

Postby rgerhards » Mon Apr 14, 2003 8:36 am

ZetaFire wrote:Hi,

Thanks for your help. After i run the script, it return value 0 for a

Does it means everything works fine?

Yes, 0 means all was successful (see manual).

ZetaFire wrote:Btw can you help to run the script to see whether file can be attach?

As it was successful, I would recommend to check the mailbox where you send the file to. If you read the mail you generated, you'll find the file attached ;)

Rainer Gerhards
Adiscon
rgerhards
Site Admin
 
Posts: 3807
Joined: Thu Feb 13, 2003 11:57 am

Postby Zetafire » Mon Apr 14, 2003 3:43 pm

Well, still no luck..... :cry: i guess i got to give up.

Thanks anyway
Zetafire
 

Postby alorbach » Tue Apr 22, 2003 12:18 pm

One last thing Zetafire, could you please check which version of SimpleMail you are using? Maybe you are using an older version.
alorbach
Site Admin
 
Posts: 1627
Joined: Thu Feb 13, 2003 11:55 am

Postby zetafire » Tue Apr 22, 2003 5:04 pm

Hi,

All the while i run the script from my XP machine. I just share out the connection from the XP machine and use a W2k server connect to this connection, yes, the attachment come out as expected. Is the script can't run properly on XP machine or just my XP machine having problem or i need to enable certain things for my XP machine?

Anyway i'll try to reinstall my XP to try out.

Sorry for all the troubles and thanks to everyone who have assist patiently
zetafire
 

Google Ads


Next

Return to SimpleMail

Who is online

Users browsing this forum: No registered users and 0 guests

cron