Source language: Translate to:

Send Mail using Secure (SSL) account

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Postby datadon » Fri Feb 06, 2009 1:31 pm

One more question if I might. I am trying to change a font in the html and it is not taking. I am using the standard:

Code: Select all
<FONT FACE='Impact' SIZE='+3' COLOR='#000000'></FONT>


but it does not take. It accepts the html but there are not font changes.

Is there another way to do this or am I in error somewhere.

I am actually trying to change a few numbers in a sentence and then change it back again.
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Postby Horst Helfen » Mon Feb 09, 2009 2:22 am

<FONT FACE='Impact' SIZE='+3' COLOR='#000000'></FONT>
Your HTML code looks stone age like. The element "FONT" is long time deprecated. Styling should be made using CSS.
But even in your code I can't recognize the text of which you want to change the font size as there is no text between <font> and </font>. So your example should read:
Code: Select all
<FONT FACE='Impact' SIZE='+3' COLOR='#000000'>[color=red]This text has its font changed![/color]</FONT>
or better:
Code: Select all
<p style="color:#000000;font-size:1.3em;font-family:Impact;">This text has its font changed!</p>
Last edited by Horst Helfen on Mon Feb 09, 2009 10:35 am, edited 2 times in total.
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Postby David de Argentina » Mon Feb 09, 2009 10:24 am

Hi Don,

I don't know much about HTML coding, but, I think if your replace the '+3' value for any "real" value (like 5,6,7... etc) the tag should work...

My devaluated cent,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Send Mail using Secure (SSL) account

Postby David de Argentina » Thu Jan 31, 2013 4:27 pm

Hi all,

I found overthere a function that saves the generated email.

This is the code:

Code: Select all
Sub SendMail(pstrFrom, pstrTo, pstrCC, pstrBCC, pstrSubject, pstrBody, Optional pstrSaveToFolder)
Const cstrSMTPServer = "MYSMTPSERVER"
Const cintCDOSendUsingPort = 2
Dim objConfig, objMsg
Dim Stm As ADODB.Stream
 
If (Len(pstrFrom & "") > 0) And (Len(pstrTo & "") > 0) And (Len(pstrSubject & "") > 0) And (Len(pstrBody & "") > 0) Then
 
    Set objConfig = CreateObject("CDO.Configuration")
    objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cintCDOSendUsingPort
    objConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = cstrSMTPServer
    objConfig.Fields.Update
   
    Set objMsg = CreateObject("CDO.Message")
    Set objMsg.Configuration = objConfig
   
    objMsg.From = pstrFrom
    objMsg.to = pstrTo
   
    If Len(pstrCC & "") > 0 Then objMsg.CC = pstrCC
    If Len(pstrBCC & "") > 0 Then objMsg.BCC = pstrBCC
   
    objMsg.Subject = pstrSubject
    objMsg.HTMLBody = pstrBody
   
    If Len(Trim(pstrSaveToFolder)) > 0 Then
        Set Stm = objMsg.getstream
        Stm.SaveToFile pstrSaveToFolder & "\Test-" & Format(Date, "mm-dd-yyyy") & ".msg", adSaveCreateOverWrite
    End If
   
    objMsg.Send
    Set objMsg = Nothing
    Set objConfig = Nothing
End If
End Sub


In fact is almost the same code.
The interesting thing is:

Code: Select all
    If Len(Trim(pstrSaveToFolder)) > 0 Then
        Set Stm = objMsg.getstream
        Stm.SaveToFile pstrSaveToFolder & "\Test-" & Format(Date, "mm-dd-yyyy") & ".msg", adSaveCreateOverWrite
    End If


I tried to add this code to the NeoBook Function, but does not work

Any VBScript Guru could do this work ?

Thanks in advance,

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Send Mail using Secure (SSL) account

Postby Neosoft Support » Fri Feb 01, 2013 3:10 pm

This function works:

Code: Select all
{NeoBook Function}
Version=5.70
Language=VBScript
Param=[%From]|Text|From:
Param=[%To]|Text|To:
Param=[%Subject]|Text|Subject
Param=[%Msg]|Text|Message:
{End}
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "[%Subject]"
objMessage.From = "[%From]"
objMessage.To = "[%To]"
'objMessage.TextBody = "[%Msg]"
objMessage.HTMLBody = "[%Msg]"

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "domainname"

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==
objMessage.Send


You will need to replace the domainname, username, password and possible the port number in the code.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Send Mail using Secure (SSL) account

Postby David de Argentina » Fri Feb 01, 2013 4:33 pm

Thanks Dave,

Perhaps i didn't explain well....

This is the original Function, that works fine:


Code: Select all
{NeoBook Function}
Version=5,60
Language=VBScript
Param=[%1]|Text|From:
Param=[%2]|Text|To:
Param=[%3]|Text|SMTP Server:
Param=[%4]|Text|User Name:
Param=[%5]|Text|Password:
Param=[%6]|Text|Message:
Param=[%7]|Text|Subject
Param=[%8]|Text|Use SSL ? ( YES / NO )
Param=[%9]|Text|Attachment
{End}

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "[%7]"
objMessage.From = "[%1]"
objMessage.To = "[%2]"
'objMessage.TextBody = "[%6]"
'objMessage.HTMLBody = "[%6]"
objMessage.CreateMHTMLBody ("file://C:/Documents and Settings/USER/Mis documentos/mail_neo.htm")
'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "[%3]"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[%4]"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "[%5]"


'Use SSL for the connection (False or True)

if "[%8]" = "NO" Then
   objMessage.Configuration.Fields.Item _
   ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
   
   'Server port (typically 25)
   objMessage.Configuration.Fields.Item _
   ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
else
   objMessage.Configuration.Fields.Item _
   ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
   
   'Server port 465
   objMessage.Configuration.Fields.Item _
   ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
end if

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

If "[%9]" <> "" Then
  objMessage.AddAttachment ("[%9]")
End If


objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

On Error Resume Next


objMessage.Send

If Err.Number = 0 Then
   msgbox "mail enviado satisfactoriamente !    ", vbInformation, " e-mail"
   'Enviar_Mail_CDO = True
Else
   MsgBox Err.Description, vbCritical, " Error al enviar el mail "
End If

Set objMessage = Nothing



I'm trying to insert this code:

Code: Select all
If Len(Trim(pstrSaveToFolder)) > 0 Then
        Set Stm = objMsg.getstream
        Stm.SaveToFile pstrSaveToFolder & "\Test-" & Format(Date, "mm-dd-yyyy") & ".msg", adSaveCreateOverWrite
End If


But i didn't put in work this code in order to save the sent messages.

Thanks again,
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Send Mail using Secure (SSL) account

Postby Neosoft Support » Mon Feb 04, 2013 12:36 pm

Maybe this article about debugging VBScript will help:

http://support.microsoft.com/kb/308364
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Previous

Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests

cron