Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Outlook mail in Plain Text 1

Status
Not open for further replies.

DaiDreamer

Programmer
May 8, 2001
31
US
Hi!

Is there a way in VBscript to send an email in plain text? When I send one though a script, it sends it though Rich Text, even though I have the default mail setting at Plain text.

Thanks!
 
enctype="text/plain"

is the setting -- are you using CDONTS or some other ASP component??

 
I don't know...

Here's the code...


Option Explicit


Const HEADER = "[!A0][D63000]09~ProjectList"
Const FOOTER = "~-999~end"
Const SQL_PROJECTS = "SELECT * FROM projects"
Const SQL_USERS = "SELECT * FROM users"

Dim objConn, objRS, email, oolApp, projects

CreateString()
GetAddresses()
SendEmails()

function CreateString()
set objConn = CreateObject("ADODB.Connection" )
objConn.Open "DSN=POCKETMOSAIC"

set objRS = objConn.Execute ( SQL_PROJECTS )

While Not objRS.EOF
MsgBox objRS( "ProjectID" )
projects = projects & "~" & objRS( "ProjectID" )
MsgBox objRS( "ProjectName" )
projects = projects & "~" & objRS( "ProjectName" )
objRS.MoveNext
Wend

objRS.close
objConn.Close

set objRS = Nothing
set objConn = Nothing

end function

function GetAddresses()

Set oolApp = CreateObject("Outlook.Application")
Set email = oolApp.CreateItem(0)


Set objConn = CreateObject( "ADODB.Connection" )
objConn.Open "DSN=POCKETMOSAIC"

Set objRS = objConn.Execute( SQL_USERS )

While Not objRS.EOF
MsgBox objRS( "PagerAddress" )
email.Recipients.Add(objRS( "PagerAddress" ))
objRS.MoveNext
Wend

objRS.Close
objConn.Close

Set objRS = Nothing
Set objConn = Nothing

end function

function SendEmails()

email.Body = HEADER & projects & FOOTER
email.Send
Set email = Nothing
MsgBox("sent e-mails!")

end function


Thanks!

 
ahhh -- using an outlook application -- and you said that, too. Sorry, I don't use that method, so I fear I can't be of assistance on this one. :-(

I can offer you this tip, though... If you want to approach it from a different angle, you could go over to and pick up Persits' free ASP component that does a beutiful job of handling email... It's very easy to setup and start using.

Just a thought. And if you don't want to do that, then you might look into the supplied CDONTS email component that you probably already have on your server. Check over at or for some good information on how to use that component.

I like the first because I can specify which SMTP server to send from, but CDONTS works fine, too.

Sorry I couldn't be of more help.

paul
 
never mind. I found out that VBscript converts outlook mail into plain text (though it didn't look like it from my point of veiw ????)


????
 
hi,
I want to connect MS access Database with MS Outlook I have written a code for this.What i want is there are many records in the database (MS Access),The fields in that is check ,check for the check Box, Email. On the Browser I am adding,updating and deleting records through ASP On clicking the check Box and hitting a button "Go" i want the Email Addressses to go to the outlook form.

i have written a vbscript for this:

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Dim MVAR
Dim MEND
Dim MSTART
Dim email
Dim oolApp
Sub button_2_onclick
MSTART = 1
MsgBox MVAR
MEND = InStr(MSTART, EMAIL, &quot;,&quot;, vbTextCompare)
Do While MEND <> 0
MVAR = Mid(EMAIL, MSTART, MEND - MSTART)
MSTART = MEND + 1
MEND = InStr(MSTART, EMAIL, &quot;,&quot;, vbTextCompare)
Loop
GetAddresses()
End Sub
function GetAddresses()
Set oolApp = CreateObject(&quot;MS Outlook.Application&quot;)
Set email = oolApp.CreateItem(0)
end function
</SCRIPT>

...and the asp part of it..which goes like this

<form>
<INPUT TYPE=&quot;Checkbox&quot; NAME=&quot;Check&quot; VALUE=&quot;0&quot;>

<table>
<tr>
<td>Email: </td>
<td>
<input type=&quot;text&quot; name=&quot;email&quot;>
</td>
</tr>
<%
Set conn = server.createobject(&quot;ADODB.connection&quot;)
Set rs = server.createobject(&quot;ADODB.recordset&quot;)
DSNtemp=&quot;DRIVER={Microsoft Access Driver (*.mdb)}; &quot;
DSNtemp=dsntemp & &quot;DBQ=&quot; & server.mappath(&quot;pricelistnew.mdb&quot;)
conn.connectionstring = dsntemp
conn.open
sqlstmt = &quot;select * from prices &quot;
Set rs = conn.Execute(SQLstmt)
rs.MoveFirst
While Not rs.EOF
If Not IsNull(rs.Fields(&quot;email&quot;).Value) Then
If emailid = &quot;&quot; Then emailid = rs.Fields(&quot;email&quot;).Value
End If
If emailid <> &quot;&quot; Then
emailid = emailid & &quot;,&quot; & rs.Fields(&quot;email&quot;).Value
End If
rs.MoveNext
Wend
emailid = Left(emailid, Len(emailid) - 1)
emailid=&quot;mailto:&quot; & emailid
rs.Close
%>
<td>
<INPUT TYPE=&quot;BUTTON&quot; NAME=&quot;button_2&quot; VALUE=&quot;Click Here!&quot;>
</td>
</form>


It gives me a error of Activex component ....

if anyone could help me....

vinay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top