Hello,
I'd like to introduce myself.I have done zero programming since the
days of GWBasic in college. I began using VB.Net 2005 around a month
ago, and even though I've had no formal training, I've found it very
easy to use by looking up docs and examples online, as well as having
found the answers to many of my questions by browsing here. Thanks to
all here! I'm quite sure that my code is not pretty, but it seems to
do the job.
That being said, I have a problem for which I have yet to find a
solution. The follow sub works fine for sending emails from my app,
with the exception that the email is sometimes not sent for two or
three minutes, and in some instances not until another is sent or I
close the app.
Is there a way to "flush" the email cue, or otherwise force the emails
to be sent immediately after this sub is called?
Thanks,
SFS
Sub MailIt(from As String, recipient As String, _
subject As String, body As String, login As String, _
password As String)
Dim mMailMessage As New MailMessage()
Dim client As New SmtpClient("smtp.myhost.com")
client.Credentials = New System.Net.NetworkCredential _
(login, password)
mMailMessage.From = New MailAddress(from)
mMailMessage.To.Add(New MailAddress(recipient))
mMailMessage.Subject = subject
mMailMessage.Body = body
mMailMessage.IsBodyHtml = False
mMailMessage.Priority = MailPriority.Normal
client.Send(mMailMessage)
End Sub 4 1217
SFS <sf****@yahoo.comwrote in news:4boms2hppc1vk2eru0r553llocfct6th46@
4ax.com:
Is there a way to "flush" the email cue, or otherwise force the emails
to be sent immediately after this sub is called?
..Send sends the e-mail off to your mail server.
If there are any delays, it might be your local mail server or the remote
mail server... or anything in between ;-)
SFS wrote:
>
Is there a way to "flush" the email cue, or otherwise force the emails
to be sent immediately after this sub is called?
A few days ago I provided the following reply to someone else with
exactly the same question (modified for your code) -
******************
I believe the answer to the Delay problem revolves around the Garbage
Collection of the Mail Message. (I haven't had a problem with this so I
can't be certain).
Try doing the following after your "client.Send(mMailMessage)" line -
mMailMessage.Dispose
If you then find a problem that your Message seems to just vanish (ie.
never gets sent) then do it this way -
System.Threading.Thread.Sleep(100)
mMailMessage.Dispose
Please post back your results so myself (and others) can be aware of
these matters in the future.
******************
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
On Fri, 09 Feb 2007 06:28:22 +1000, ShaneO <sp****@optusnet.com.au>
wrote:
>SFS wrote:
>> Is there a way to "flush" the email cue, or otherwise force the emails to be sent immediately after this sub is called?
<snip>
>Try doing the following after your "client.Send(mMailMessage)" line -
mMailMessage.Dispose
If you then find a problem that your Message seems to just vanish (ie. never gets sent) then do it this way -
System.Threading.Thread.Sleep(100) mMailMessage.Dispose
Thanks, ShaneO. mMailMessage.Dispose (without the sleep) seems to
have fixed the problem.
SFS
hey dipshit
no matter what you do; do NOT put your marbles in the MS camp
MS does not give a shit about programmers; they have demonstrated this
time and time again
maybe they'll invent L## next month and stop giving a crap about all
this dotnet crap
SERIOUSLY
ms betrayed us all, move to PHP or get shafted eventually
On Feb 8, 9:58 am, SFS <sfs...@yahoo.comwrote:
Hello,
I'd like to introduce myself.I have done zero programming since the
days of GWBasic in college. I began using VB.Net 2005 around a month
ago, and even though I've had no formal training, I've found it very
easy to use by looking up docs and examples online, as well as having
found the answers to many of my questions by browsing here. Thanks to
all here! I'm quite sure that my code is not pretty, but it seems to
do the job.
That being said, I have a problem for which I have yet to find a
solution. The follow sub works fine for sending emails from my app,
with the exception that the email is sometimes not sent for two or
three minutes, and in some instances not until another is sent or I
close the app.
Is there a way to "flush" the email cue, or otherwise force the emails
to be sent immediately after this sub is called?
Thanks,
SFS
Sub MailIt(from As String, recipient As String, _
subject As String, body As String, login As String, _
password As String)
Dim mMailMessage As New MailMessage()
Dim client As New SmtpClient("smtp.myhost.com")
client.Credentials = New System.Net.NetworkCredential _
(login, password)
mMailMessage.From = New MailAddress(from)
mMailMessage.To.Add(New MailAddress(recipient))
mMailMessage.Subject = subject
mMailMessage.Body = body
mMailMessage.IsBodyHtml = False
mMailMessage.Priority = MailPriority.Normal
client.Send(mMailMessage)
End Sub
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Neil Greenough |
last post by:
I ain't got the foggiest about ASP, but I know I need to use it to create
what I am after in my website. Could anyone please give me a brief
introduction about ASP, example how you enter it into a...
|
by: Joe |
last post by:
Hi,
I am sending an email from an asp page. Besides sending an email to sender,
I am sending myself a BCC also. Out of 100 emails sent, about 5 recipients
received a blank email (no text in...
|
by: joe215 |
last post by:
I want my users to send emails from a Windows app that I am developing in
Visual Basic.NET 2003. I found a good example of sending email to a SMTP
server using the SmtpMail class. However, using...
|
by: Eduardo Rosa |
last post by:
Somebody knows how I queue email using .Net?
thanks a lot
|
by: B-Dog |
last post by:
I've built a small app that sends mail through our ISP's SMTP server but
when I try to send through my local exchange server I get CDO error. Does
webmail use SMTP or does it strictly rely on...
|
by: Ant |
last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send
mail, however it's not sending any emails.
I'm using it on a Windows 2003 server.
The simplest way to use this is...
|
by: Xah Lee |
last post by:
Of Interest:
Introduction to 3D Graphics Programing
http://xahlee.org/3d/index.html
Currently, this introduction introduces you to the graphics format of
Mathematica, and two Java Applet...
|
by: JJ297 |
last post by:
Hello,
After a user enters their request I'm sending a generated email to
someone. How do I get that question to appear in the email? I have
the link appearing in the email. This is what I...
|
by: JoeP |
last post by:
Hi All,
How can I find the reason for such an error: Failure sending mail.
Some Code...
oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody
Dim oSMTP As New SmtpClient...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |