Internet is growing Every Seconds :: Industry is growing Every Year

Saturday, July 16, 2005

send email Using cdo message

Send email Using cdo message

toaddress=request.form("toemail") //Get the value from previuos page
fromaddress=request.form("fromemailadd")
mailsubject=request.form("title")
mailbody=request.form("comm")
'Response.Write (toaddress)
'Response.Write (fromaddress)
'Response.Write (mailsubject)
'Response.Write (mailbody)
'Response.Write ("dddddddddd")
'Response.End

sub sendemail(toaddress,fromaddress,mailsubject,mailbody)
set imsg = createobject("cdo.message")
set iconf = createobject("cdo.configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.94.5.2" /// Give u r smtp address
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "61.11.74.157"
.Update
End With

With iMsg
Set .Configuration = iConf
.To = toaddress
.From = fromaddress
' .CC = "ACCId@meijer.com"
.Subject = mailsubject
.TextBody = mailbody
.fields.update
.Send
End With
set imsg = nothing
set iconf = nothing
end sub


Following code is used to call the send email functions
call sendemail(toaddress,fromaddress,mailsubject,mailbody)