?
Solved

problem in sending email

Posted on 2005-03-14
9
Medium Priority
?
192 Views
Last Modified: 2013-11-13
Hi,

I am using Winsock class to send email from VB. However, I cannot send the attachment if it is more than 100KB. Any Idea?

Private Sub WinsockSendData(DatatoSend As String)
Dim RC As Integer
' 16384
' 8192
Dim MsgBuffer As String * 8192
'You can open more than one connection!

RC = send(Sock, ByVal MsgBuffer, Len(DatatoSend), 1)

'If an error occurs send an error message and
'reset the winsock
If RC = SOCKET_ERROR Then
    Process = "Cannot Send Request." & Str$(WSAGetLastError()) & GetWSAErrorString(WSAGetLastError())
    Writelog ("Cannot Send Request." & Str$(WSAGetLastError()) & GetWSAErrorString(WSAGetLastError()))
    closesocket Sock
    Call EndWinsock
    Exit Sub
End If
End Sub

Are the information above enough? I am not VB programmer so I do not know.

Thanks and regards
Dave
0
Comment
Question by:suprapto45
  • 5
  • 3
9 Comments
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 1600 total points
ID: 13539399
Go here, they have a good example and URLs , it says that using MAPI would be the easiest way, and it also has an example using winsock :) I hope this helps

http://www.tek-tips.com/viewthread.cfm?qid=214716&page=1
0
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 13539856
As an alternative to Winsock, try using CDO:

     Dim oMail
     Set oMail = CreateObject("CDO.Mail")

     oMail.From = "me@here.com"
     oMail.To = "you@there.com"
     oMail.Subject = "Test Mail"
     oMail.TextBody = "This is the email"
     oMail.AddAttachment "x:\mypath\myfile.att"
     oMail.Send

If that doesn't work, you may need to adjust the CDO configuration...

HTH

J.
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13540668
Here is another good one I have found :

http://www.developerfusion.com/show/2453/

I also reccomend going to :

www.allapi.net

www.codeguru.com

www.pscode.com

I hope they help you out, the first one explains all about sending and recieving using winsock and pop3

Good luck with it :D
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13540684
Here is a site that even has a download with source code as far as I am aware of using winsock to send an email with an attachment :) and even refers to an MS KB site :)

http://www.vbip.com/winsock/winsock_simple_sender_02.asp
0
 
LVL 16

Author Comment

by:suprapto45
ID: 13540961
Well, I think that I am not going into other's codes since my programmers have programmed it in such a way so that it should not look for the default email client. It would search the internet for the reliable SMTP server and send the email via it.

Any idea?

Regards
Dave
0
 
LVL 16

Author Comment

by:suprapto45
ID: 13540971
But it gives me a new and fresh idea. Please wait for a while.

Thanks

Regards
Dave
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13541478
Hey Dave,

how long do you mean when you say a while, just out of curiousty :) ?

~GO
0
 
LVL 16

Author Comment

by:suprapto45
ID: 13542284
not that while :). It could be days sometimes :). Anyway, thansk for the info gecko_au2003. I appreciate it. I am testing all the solutions now.

Regards
Dave
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13542413
oh ok, not a problem Dave. Take your time and look forward to hearing back from you with your results :)
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question