Difference between wodSmtp1.SendMessage and wodSm - WeOnlyDo Discussion board

Difference between wodSmtp1.SendMessage and wodSm (General questions)

by Nightwalker, Wednesday, August 04, 2010, 12:06 (5224 days ago)

Hi,

What is the difference between wodSmtp1.SendMessage and wodSmtp1.SendSimple? Also, which would I use when I want to send an attachment(s), wodSmtp1.Message.Attach or wodSmtp1.SendSimpleAttachment?

When I try using wodSmtp1.SendMessage I receive the runtime error '30010': Sender not specified but if I use wodSmtp1.SendSimple I don't.

Thanks,


Nightwalker

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Wednesday, August 04, 2010, 12:09 (5224 days ago) @ Nightwalker

Hi,

The difference is that SendSimple and SendSimpleAttachment will automatically create a Message object for you.

SendMessage on the other hand expects that you already created one by yourself.

In other words, you are receiving this error, because wodSmtp.Message object isn't populated (Sender atually isn't specified).

Hope this helps.

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by Nightwalker, Wednesday, August 04, 2010, 14:03 (5224 days ago) @ wodDamir

You are receiving this error, because wodSmtp.Message object isn't populated (Sender atually isn't specified).

Hi,

Could you give me an example how I would send an email with an attachment using sendmessage?

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Wednesday, August 04, 2010, 14:14 (5224 days ago) @ Nightwalker

Hi,

Perhaps it would be best for you to check our samples. I.e. 4. Use 'smarthost' describes exactly what you're trying.

Basically, you need to set the properties SendSimple method does on your own:

[code] wodSmtp1.Message.From = sender_email
wodSmtp1.Message.To = receiving_email
wodSmtp1.Message.Subject = E-Mail subject
wodSmtp1.Message.Text = message content

wodSmtp1.SendMessage [/code]

Something like that should work. Please give it a try.

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Thursday, August 05, 2010, 09:40 (5223 days ago) @ wodDamir

Damba,

I still receiving the no sender message! This is the code I am using:

'Check for attachments.
If frmAttachments.LstFiles.ListCount <> 0 Then
For a = 0 To frmAttachments.LstFiles.ListCount - 1
For S = 1 To (frmAttachments.LstFiles.ListCount)
sp = Split(frmAttachments.LstFiles.List(a), )
frmMain.wodSmtp1.Message.attach (frmAttachments.LstFiles.List(a))
Next S
Next a
frmMain.wodSmtp1.MailFrom = spehr.aaron@gmail.com
'frmMain.wodSmtp1.Message.
frmMain.wodSmtp1.Message.To = frmCompose.txtTo.Text
frmMain.wodSmtp1.Message.Subject = frmCompose.txtSubject.Text
frmMain.wodSmtp1.Message.Body = frmCompose.txtBody.Text
frmMain.wodSmtp1.SendMessage
End If

Re: Difference between wodSmtp1.SendMessage and w

by woddrazen, Thursday, August 05, 2010, 10:35 (5223 days ago) @ nightwalker83

Hi,


Are you sure that you need to use Body Property? Body Property holds complete body of message, including headers. Headers include sender of message and other informations.

Can you maybe try to use Text Property instead? Text Property holds body without headers.


Drazen

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Thursday, August 05, 2010, 10:51 (5223 days ago) @ woddrazen

Hi,


Are you sure that you need to use Body Property? Body Property holds complete body of message, including headers. Headers include sender of message and other informations.

Can you maybe try to use Text Property instead? Text Property holds body without headers.


Drazen

Tried that but it didn't work.

Re: Difference between wodSmtp1.SendMessage and w

by woddrazen, Thursday, August 05, 2010, 10:58 (5223 days ago) @ nightwalker83

Hi,


What happens if you try this code
[code]frmMain.wodSmtp1.MailFrom = spehr( point )aaron( at )gmail( point )com
frmMain.wodSmtp1.Message.To = frmCompose.txtTo.Text
frmMain.wodSmtp1.Message.Subject = frmCompose.txtSubject.Text
frmMain.wodSmtp1.Message.Text = frmCompose.txtBody.Text
frmMain.wodSmtp1.Blocking = True
frmMain.wodSmtp1.SendMessage[/code]
Drazen

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Thursday, August 05, 2010, 12:25 (5223 days ago) @ woddrazen

Hi,


What happens if you try this code
[code]frmMain.wodSmtp1.MailFrom = spehr( point )aaron( at )gmail( point )com
frmMain.wodSmtp1.Message.To = frmCompose.txtTo.Text
frmMain.wodSmtp1.Message.Subject = frmCompose.txtSubject.Text
frmMain.wodSmtp1.Message.Text = frmCompose.txtBody.Text
frmMain.wodSmtp1.Blocking = True
frmMain.wodSmtp1.SendMessage[/code]
Drazen

Tried setting

frmMain.wodSmtp1.Blocking = True

and

frmMain.wodSmtp1.Blocking = False

but receive Runtime error '30013'

Destination SMTP server rejected the sender.

and it still highlights:

frmMain.wodSmtp1.SendMessage

Re: Difference between wodSmtp1.SendMessage and w

by woddrazen, Thursday, August 05, 2010, 12:46 (5223 days ago) @ nightwalker83

Hi,


If you want to send email using your gmail account you should try something like this:
http://example.weonlydo.com/index.asp?did=Sending-email-messages-to-Gmail-using-SMTP-protocol

as you can see you should first authenticate with Gmail server.

You can also send email using your ISP and your ISP SMTP server.

In order to do that you should add this code before your code:
[code]wodSmtp1.HostName = your.isp.smtp.hostname
wodSmtp1.Blocking = True
wodSmtp1.Connect[/code]
Drazen

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Friday, August 06, 2010, 02:34 (5222 days ago) @ woddrazen

I am now trying the simple send attachments I receive an object required error on the attach line.

If frmAttachments.LstFiles.ListCount <> 0 Then
For a = 0 To frmAttachments.LstFiles.ListCount - 1
attach = frmAttachments.LstFiles.List(a)
Next a

I just tried it with simple message attachment but it can't or won't handle more than one attachment at a time. I even tried combining the message.attach with simple attach but that didn't work either.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Friday, August 06, 2010, 09:22 (5222 days ago) @ nightwalker83

Hi,

The code you provided doesn't call any method at all. Please try something like:

[code]For a = 0 To frmAttachments.LstFiles.ListCount - 1
attach = wodSmtp1.Message.Attach(frmAttachments.LstFiles.List(a))
Next a
[/code]

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Friday, August 06, 2010, 09:40 (5222 days ago) @ wodDamir

Hi,

The code you provided doesn't call any method at all. Please try something like:

[code]For a = 0 To frmAttachments.LstFiles.ListCount - 1
attach = wodSmtp1.Message.Attach(frmAttachments.LstFiles.List(a))
Next a
[/code]

Thanks, that should solve the attachment problem. However, I still can't use .SendMessage.
' This line is is suppose to set the sender of the message as the login address
.Message.From = frmSettings.txtUsername.Text

However, I still receive the no sender I have tried everything that has already been suggested in this thread.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Friday, August 06, 2010, 09:48 (5222 days ago) @ nightwalker83

Hi,

What e-mail account are you trying to use? Do you need to authenticate to e-mail server?

Can you show me your code where you set e-mail properties (From, To, etc. before you call SendMessage?

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Friday, August 06, 2010, 09:59 (5222 days ago) @ wodDamir

Hi,

What e-mail account are you trying to use? Do you need to authenticate to e-mail server?

Can you show me your code where you set e-mail properties (From, To, etc. before you call SendMessage?

Regards,
Damba


The account settings:
Public Function Login()
Select Case frmSettings.cboHost.Text
Case Gmail
With Smtp

.HostName = smtp.gmail.com
.Authentication = AuthAuto
.Blocking = True
.Security = SecurityImplicit
.MailFrom = spehr.aaron@gmail.com
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.Port = 465
.Connect
End With
With Pop3
.HostName = pop.gmail.com
.Authentication = AuthAuto
.Security = SecurityImplicit
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.Port = 995
.Connect
End With
frmMain.Caption = frmMain.Caption + + frmSettings.cboHost.Text
End Select
End Function

The mailing send:

With Smtp
.Message.attach C:UsersNightwalkerDesktopMail version 3.0.1MailfrmAttachments.log
.Message.From = frmSettings.txtUsername.Text
.Message.To = frmCompose.txtTo
.Message.Subject = frmCompose.txtSubject.Text
.Message.Body = frmCompose.txtBody.Text
.SendMessage
End With

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Friday, August 06, 2010, 10:02 (5222 days ago) @ nightwalker83

NightWalker,

You're setting Body property just before sending the message. Since Body property contains the actual *BODY* of the message, including the Headers, you basically erase the TO, FROM, etc. headers.

Instead of setting the Body property to message contents, please try setting Text, PlainText, or HTMLText properties. These are the ones that should contain message text.

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Friday, August 06, 2010, 10:11 (5222 days ago) @ wodDamir

NightWalker,

You're setting Body property just before sending the message. Since Body property contains the actual *BODY* of the message, including the Headers, you basically erase the TO, FROM, etc. headers.

Instead of setting the Body property to message contents, please try setting Text, PlainText, or HTMLText properties. These are the ones that should contain message text.

Regards,
Damba

Well, I still receive the Destination SMTP Server rejected the sender even after adding .Blocking = True in the send event and after that on load.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Friday, August 06, 2010, 10:15 (5222 days ago) @ nightwalker83

Hi,

What happens if you set Authentication to authLogin?

Also, can you please check Transcript property in Disconnected event? Can you paste it ?

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Friday, August 06, 2010, 10:25 (5222 days ago) @ wodDamir

Hi,

What happens if you set Authentication to authLogin?

Also, can you please check Transcript property in Disconnected event? Can you paste it ?

Regards,
Damba

I don't have the disconnect events for the smtp and pop but I call Pop3.Disconnect
Smtp.Disconnect

I changed from using the components to referencing the dlls in my project.

when I quit the program. What does Transcript do?


What happens if you set Authentication to authLogin?

I still get the same rejection error.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Friday, August 06, 2010, 12:51 (5222 days ago) @ nightwalker83

Hi,

The Transcript property holds the communication between client and server. I hope it could contain information on why you're being rejected by server. Could you please provide it (make sure you remove any sensitive information from it)?

Also, can you please try the Using SmartHost sample? Does it work?

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Friday, August 06, 2010, 13:43 (5222 days ago) @ wodDamir

This is the transcript data:

220 mx.google.com ESMTP 36sm3366067ybr.8
EHLO
250-mx.google.com at your service,
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250 ENHANCEDSTATUSCODES

I put the transcript method before the send method.

Not response from Smarthost it is taking a long time but then again pop3 took a while before it retrieved the contents of my mail box.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Friday, August 06, 2010, 16:24 (5221 days ago) @ nightwalker83

NightWalker,

This only tells the part where authentication and connection take part. However, I need the actual headers (commands) sent to the server. That's why I asked for Transcript before the disconnection takes place (which should contain whole client -> server communication).

Can you please provide that?

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Saturday, August 07, 2010, 04:53 (5221 days ago) @ wodDamir

NightWalker,

This only tells the part where authentication and connection take part. However, I need the actual headers (commands) sent to the server. That's why I asked for Transcript before the disconnection takes place (which should contain whole client -> server communication).

Can you please provide that?

Regards,
Damba

Ak ok! I have place the transcript in the smtp disconnect event and disconnect from smtp after I send the email. However, the rejection error triggers before the disconnect event. Also, I tried smart host but it didn't work although, I know both pop and smtp connect because I can connect using the simple method.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Saturday, August 07, 2010, 11:15 (5221 days ago) @ nightwalker83

Hi,

In Blocking mode, you need to handle possible exceptions using the On Error statement, since the component won't handle them automatically in that case. That's probably why the events aren't reached.

Also, the following code works just fine on gmail:

[code]smtp.HostName = smtp.gmail.com
smtp.Security = SecurityImplicit
smtp.Login = username
smtp.Password = password
smtp.Authentication = AuthLogin
smtp.Blocking = True
smtp.Connect

smtp.Message.From = e-mail
smtp.Message.To = e-mail

smtp.Message.Subject = test
smtp.Message.Text = testing

smtp.SendMessage[/code]

Can you try the same code?

Regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Saturday, August 07, 2010, 12:41 (5221 days ago) @ wodDamir

Hi,

In Blocking mode, you need to handle possible exceptions using the On Error statement, since the component won't handle them automatically in that case. That's probably why the events aren't reached.

Also, the following code works just fine on gmail:

[code]smtp.HostName = smtp.gmail.com
smtp.Security = SecurityImplicit
smtp.Login = username
smtp.Password = password
smtp.Authentication = AuthLogin
smtp.Blocking = True
smtp.Connect

smtp.Message.From = e-mail
smtp.Message.To = e-mail

smtp.Message.Subject = test
smtp.Message.Text = testing

smtp.SendMessage[/code]

Can you try the same code?

Regards,
Damba


I receive a connection timed out error.

Re: Difference between wodSmtp1.SendMessage and w

by wodDamir, Saturday, August 07, 2010, 13:07 (5221 days ago) @ nightwalker83

Nightwalker,

Can you please contact me at techsupport@weonlydo.com and I'll send you a simple application, which connects to 'smtp.gmail.com' and sends out an e-mail?

regards,
Damba

Re: Difference between wodSmtp1.SendMessage and w

by nightwalker83, Sunday, August 08, 2010, 04:34 (5220 days ago) @ wodDamir

Nightwalker,

Can you please contact me at techsupport@weonlydo.com and I'll send you a simple application, which connects to 'smtp.gmail.com' and sends out an e-mail?

regards,
Damba

Thanks! That example works. I finally managed to get my project working how it was supposed to.