Link to home
Start Free TrialLog in
Avatar of furious581
furious581

asked on

what is the command to send email

hi
I have a spare parts form and when spare parts is out of stock a new form comes in which it should contact the suppliers by email how can I do that Please let me know
Exactly what I need is that when I press the button I want all the information to be sent by email through outlook express

Thanks
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

vbSendMail, easy to use less bugs than MAPI, won't send viruses, you'll love it!

http://www.freevbcode.com/ShowCode.Asp?ID=109

Best of luck....
If Outlook express is your default mail:
' paste this code in notepad, save it as frmDefMail and add to your project:


VERSION 5.00
Begin VB.Form frmDefMail
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Open default Client Mail"
   ClientHeight    =   3675
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3675
   ScaleWidth      =   4680
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command1
      Caption         =   "&Cancel"
      Height          =   375
      Index           =   1
      Left            =   3345
      TabIndex        =   11
      Top             =   3225
      Width           =   1215
   End
   Begin VB.CommandButton Command1
      Caption         =   "&Open Default"
      Height          =   375
      Index           =   0
      Left            =   2010
      TabIndex        =   10
      Top             =   3225
      Width           =   1215
   End
   Begin VB.TextBox Text1
      Height          =   1575
      Index           =   4
      Left            =   1095
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   9
      Top             =   1575
      Width           =   3450
   End
   Begin VB.TextBox Text1
      Height          =   300
      Index           =   3
      Left            =   1095
      TabIndex        =   7
      Top             =   1200
      Width           =   3450
   End
   Begin VB.TextBox Text1
      Height          =   300
      Index           =   2
      Left            =   1095
      TabIndex        =   5
      Top             =   825
      Width           =   3450
   End
   Begin VB.TextBox Text1
      Height          =   300
      Index           =   1
      Left            =   1095
      TabIndex        =   3
      Top             =   435
      Width           =   3450
   End
   Begin VB.TextBox Text1
      Height          =   300
      Index           =   0
      Left            =   1095
      TabIndex        =   1
      Top             =   60
      Width           =   3450
   End
   Begin VB.Label Label1
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Message:"
      Height          =   195
      Index           =   4
      Left            =   120
      TabIndex        =   8
      Top             =   1620
      Width           =   690
   End
   Begin VB.Label Label1
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Subject:"
      Height          =   195
      Index           =   3
      Left            =   120
      TabIndex        =   6
      Top             =   1245
      Width           =   585
   End
   Begin VB.Label Label1
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "BCC:"
      Height          =   195
      Index           =   2
      Left            =   120
      TabIndex        =   4
      Top             =   870
      Width           =   360
   End
   Begin VB.Label Label1
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "CC:"
      Height          =   195
      Index           =   1
      Left            =   120
      TabIndex        =   2
      Top             =   480
      Width           =   255
   End
   Begin VB.Label Label1
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "To:"
      Height          =   195
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   105
      Width           =   240
   End
End
Attribute VB_Name = "frmDefMail"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
    ShellExecute 0, vbNullString, _
                 "mailto:" & Text1(0).Text & _
                 "?subject=" & Text1(3).Text & _
                 "&body=" & Text1(4).Text & _
                 "&CC=" & Text1(1).Text & _
                 "&BCC=" & Text1(2).Text, _
                 0&, 0&, 1

Case 1
    Unload Me
End Select
End Sub

Avatar of Mike McCracken
Mike McCracken

learning
Avatar of furious581

ASKER

HI  Richie_Simonetti

THe complier gave me an error on the below acually it couldn't be defined

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal
lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long

ASKER CERTIFIED SOLUTION
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Inthedark is right!
Hi furious581,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Split points between: inthedark and Richie_Simonetti

furious581, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange

points for Richie_Simonetti at:
https://www.experts-exchange.com/questions/20505888/points-for-Richie-Simonetti-re-various.html