473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem in Sending Mail using CDO in VB.net

Hi,
I have used CDO object in my vb.net code to send a mail. When i Send a mail, it sends the mail only after closing the application. Can any one help me please ?.

my code is below.

objmessage = CreateObject("CDO.Message")
objmessage.Subject = oUDS26.Value
objmessage.From = strUserEmail
objmessage.To = oUDS27.Value
objmessage.TextBody = "Please find the attachment."
objmessage.addattachment(strAttachment)
With objmessage.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strSMTPUser
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strSMTPPassWord
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = CType(strSendUsing, Integer)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = CType(strSmtpAuthentication, Integer)
.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CType(strSmtpPort, Integer)
.Update()

end with

objmessage.Send()


Thanks in advance.


Kandan Mani.
May 24 '07 #1
2 2961
kenobewan
4,871 Expert 4TB
Try moving objmessage.Send() up a line.
May 24 '07 #2
Try moving objmessage.Send() up a line.
hi kenobewan,

Thanks for your reply. I have changed the code like this.


objmessage = CreateObject("CDO.Message") objmessage.Subject = oUDS26.Value
objmessage.From = strUserEmail
objmessage.To = oUDS27.Value
objmessage.TextBody = "Please find the attachment."
objmessage.addattachment(strAttachment)
objmessage.send() '// I have written this code here. Actually this code was after the configuration settings updation.
With objmessage.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strSMTPUser
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strSMTPPassWord
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = CType(strSendUsing, Integer)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = CType(strSmtpAuthentication, Integer)
.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CType(strSmtpPort, Integer)
.Update()

End With


Now , It sends the mail Immediately before closing the application.It sends the mail for the mail ids which ends with yahoo.com,gmail.com etc. But, It never sends the mail for the mail ids which ends with .yahoo.co.in. While sending mail, In my system, the Symantic Client Firewall says that my mail server rejected the mail( only for yahoo.co.in) . Why ?


Note: When I write the code objmessage.sendmail after updating the configuration settings, It sends the mail to yahoo.co.in too. But, the problem was to close the application to send the mail

Kandan mani
May 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Serge Myrand | last post by:
Hi everybody, The following code for sending email (found on msn I think) works find when used in a .VBS file. I double click the file and the mail is send. When I use the same code in my .ASP...
1
by: Hari | last post by:
Hi all! I am trying to send mail using outlook in my web application. i am using Outlook Express. Actually i am saving it in DRAFTS folder instead of sending it. My system are in network. I hard...
3
by: at | last post by:
Hi, I need to test a mail function through my IPS, who doesn't allow sending mail without a password. Where do I specify this password? In php.ini I can specify SMTP and sender, but apparently...
2
by: ינון אזרד | last post by:
Hi. I tring to send a email. I wrote the following lines: (Imports System.Net.Mail) Dim MailMsg As New MailMessage Dim WithEvents MailSmtp As New SmtpClient MailSmtp.Host = gmail.smtp.com...
2
by: prasenjit2007 | last post by:
Hello, can u help me sending Email with attachments using the Class phpMailer. On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name)...
4
by: bgs | last post by:
i'm trying to send mail from asp server in two ways, the first uses CDONTS.Newmail: <% Dim objCDOMail Set objCDOMail = Server.CreateObject("CDONTS.NewMail") objCDOMail.BodyFormat = 1 ...
4
by: vivekshekar | last post by:
I'm using Ubuntu OS, I'm trying to send a mail through a program, but I'm not able to do this. This is the program, <?php $Name = "xxx";
1
by: dilip1076 | last post by:
I developed an application to send mail using smtpClient. my mail server is mail.brm.edu.in. I am passing this as "smtp.mail.brm.edu.in" but i'm unable to send. It shows failure sending mail. plz...
4
by: Kapil Choubisa | last post by:
Hello all I am using smtp for sending mail. it ask the smtp host name. that is smtp.Host = "smtp.gmail.com"; what is for yahoo/rediff/hotmail is there any one for globle mail systems.
0
by: m103069 | last post by:
Dear Friend, I am developing an application where i am using System.Net.Mail Namespace. its working fine if mail sending through hosting server but i am not able to send mail using lotus note...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.