Sending Emails

OK I am stumped, I still dont understand the hyperlink thing, but I have tried everything I can think of to add attachments to this but I keep getting object not supported or something to that effect.

Is it possible with this method???
 
Here is a method of adding attachments:

If anyone knows how to add an attachment without first outputing it I would be intrested.

Function sendtest()

' Send by connecting to port 25 of the SMTP server.
Dim Msg
Dim Conf
Dim Flds
Dim strHTML
Dim Attach
Dim FSO


Const cdoSendUsingPort = 2

Set Msg = CreateObject("CDO.Message")
Set Conf = CreateObject("CDO.Configuration")

Set Flds = Conf.fields



' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' SMTP SERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserver" ' IP OF SERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

' Apply the settings to the message.


With Msg
Set .Configuration = Conf
.To = "<someone@someplace.com>"
.From = "<someone@someplace.com>"
.Subject = "Test Message"
.HTMLBody = strHTML
'This adds the attachment
Set Attach = Msg.AddAttachment("C:\test.xls")
.Send
MsgBox "Mail Sent!"



End With

' Clean up variables.

Set Msg = Nothing
Set Conf = Nothing
Set Flds = Nothing

End Function
 
Now I know how to do this with VBA code. Now I have another question...Maybe does not belong here. How would I accomplish the same this using VBscript? I am trying to make a fillable form to send the email automatically

Thanks for any direction
 
CDONTS

This is the format for a CDONTS email.

<%
Dim MyMail
Set MyMail = Server.CreateObject("CDONTS.NewMail")
MyMail.From = "justme@myaddress.com"
MyMail.To = "friend1@address1.com;friend2@address2.com"
MyMail.Cc = "friend3@address3.com;friend4@address4.com"
MyMail.Bcc = "friend5@address5.com;friend6@address6.com"
MyMail.Subject = "sending email via CDONTS NewMail"
MyMail.BodyFormat = 1 ' set for HTML email
MyMail.MailFormat = 0 ' set for HTML email
MyMail.Importance = 2
MyMail.Body = "Sending email with CDONTS NewMail" &_
"objects is easy! Try it!"
MyMail.Attachfile "c:\path\smiley.gif", "smilefile.gif", 1
MyMail.Send
Set MyMail = Nothing
%>

Code nicked from:
http://www.devguru.com/features/tutorials/cdonts/cdonts.html
 
here we go again... I can email and send attachments using my work exchange server and my home roadrunner server. Now the problem is at work if I try to email outside of the corporate emails I get a relaying is prohibited error. Any idea how to send it out of of the exchange server?
 
chewy,

Most likely your problem is your exchange server is authenticating outbound mail, this setting which can be turned on and off in the exchange server. One way around it is to ask your exchange server admin to not authenticate mail from a particular email address.
 
Does it matter that I can email outside of the company with no problem with Outlook?
 
No, here is my understanding (it may or may not be completely right) when your sending with CDO your not using an outlook type mail program so the exchange server can't authenticate based upon the "tags" outlook or other mail program adds to your messages. again this is only my understanding. If I find additional information I will let you know.
 
I am using this method in Word. Sorry if this is in the wrong forum. It works fine for me and someone else but one other person I had test this gets runtime error on

Set iMsg = CreateObject("CDO.Message")

Any ideas on what this person might be missing? Or need to have? They have the same references as me. Thanks for any help!
 
Problem

I used your code to my PC which is connected with modem.

I tried to send email with the following code but I received the error: "The server rejected one or more recipient addresses. The server response was: 550 not local host hotmail.com, not a gateway"

Which is my wrong?


Public Function SendEMail_CDO(strFrom, strTo, strCC, strSubject, strBody)
On Error GoTo ErrorHandling

Dim mail
Dim config
Dim fields

Set mail = CreateObject("CDO.Message")
Set config = CreateObject("CDO.Configuration")
Set fields = config.fields


With fields

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' SMTP SERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.itsi.gr" ' IP OF SERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

Set mail.Configuration = config

With mail
.From = strFrom
.To = strTo
.CC = strCC
.Subject = strSubject
.TextBody = strBody
.Send
End With

Set mail = Nothing
Set fields = Nothing
Set config = Nothing

ErrorHandling:
Debug.Print Err.Description

End Function
 
I used your code to my PC which is connected with modem.

I tried to send email with the following code but I received the error: "The server rejected one or more recipient addresses. The server response was: 550 not local host hotmail.com, not a gateway"

Which is my wrong?


Public Function SendEMail_CDO(strFrom, strTo, strCC, strSubject, strBody)

Dim mail
Dim config
Dim fields

Set mail = CreateObject("CDO.Message")
Set config = CreateObject("CDO.Configuration")
Set fields = config.fields


With fields

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' SMTP SERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.itsi.gr" ' IP OF SERVER
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

Set mail.Configuration = config

With mail
.From = strFrom
.To = strTo
.CC = strCC
.Subject = strSubject
.TextBody = strBody
.Send
End With

End Function
 
Win 98 - SendEmail_CDO

I'm working in Win 98. Do you know if function SendEmail_CDO does it work in Win98?
 
Sendemail - Win98 - Network

Chewy has replied above with following message

"Here is a sample using the method talked about in this thread. All you have to do is change the SMTP server name in the code. It says in the comments where to look and also in this thread.

Attachment: email.zip"

I opened the code and I saw the following remark:

' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

Please clarify what do you mean.

ÁÁ. I'm using win98 attached to modem My SMTP is mail.itsi.gr and SMTP port is 25.
How can modify your code in order to send email.

ÂÂ. Also tell me please what I have to change to my code when I work win98 in network and connecting to Internet through proxy server.

Thanks
Michael
 

Users who are viewing this thread

Back
Top Bottom