?
Solved

problem in sending email

Posted on 2005-03-14
9
Medium Priority
?
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
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 …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

762 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