Email

Thanks Hay! Thats given me something to go on, your fab honey! no doubt ill be in touch to let you know how it goes or if i have any problems!
 
Im not having any luck with this eh! I keep getting asked to create a new email account and it asks for the pop3 address etc i dont know this, if i cancel that then the email is opened but nothing goes into the TO: section!!!! :(
 
here is the code i have i cant test this as i cant get it to work, i used what Hay gave me and added what i thought might be ok for the attachment??? can anyone help??

Private Sub cmdEmail_Click()
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("TblContacts")

Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("Email").Value
DoCmd.SendObject , , , strEmail, , , "Subject", "Advert" & vbCrLf & vbCrLf & "Message", False
EmailSend.Attachments.Add "A:\"
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
MsgBox "Emails have been sent"
End Sub
 
on reading someone elses post i cant see what i has gone wrong?
the code joined together should work! im stuck now! looking up help again but its not very good!

there is two ways that would suit what im supposed to do

1. open outlook from access passing all the addresses in the subform into the Bcc section then just using the attach button in outlook before hitting send.

OR

2. hitting the email button in access and getting a prompt for the attachment, adding the attachment and that being sent to every addrss in the subform one by one with the address in the To: section of outlook.

think the way were headed just now is 2. but there has to be something wrong somewhere as it wont work. please help! :(
 
Hi Lyns

I've tested it for you and this works, it takes the contents of your table tblcontacts and adds this to the email as an attachment (I realise this is not the desired attachment) it;s just an example of how to use the sendobject , all you need to do is change the file type and what you want to attach.

like this:

Private Sub CmdEmail_Click()
Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("QueryName")

Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("Email").Value
DoCmd.SendObject acSendTable, "tblcontacts", acFormatXLS, _
strEmail, , , "Subject", "Advert" & vbCrLf & vbCrLf & "Message", False
rsEmail.MoveNext
Loop
Set rsEmail = Nothing
MsgBox "Emails have been sent"
End Sub
 
lynsey2


Are you still having trouble??

I have a solution which doesnt use docmd.sendobject

Let me know if you want it?



ShadeZ
 
why doesnt it work for me??? i keep getting asked about pop3 addresses and i dont know them! uni server is down at 4 so im totaly (******swear word*******)**** **** **** ****
:( :( :( :(
 
ShadeZ anything! really anything...within the past two days i have lost so much hair and half of its grey now too :( im stressed to the max
 
im getting the msgbox emails have been sent but it is then opening outlook with nothing in the to bit.... im testing it to my email address and im getting nothing through either! so its not sending the email but going through the code to get to the msgbox
 
oh do you know what....just guess...wait for this..... AS A STUDENT YOU CANT USE OUTLOOK HERE said the wee man behind the FU***** desk WHATS the bloody point of the computer lab then if you can use FU***** OUTLOOK OR HALF THE PROGRAMS!!!!!!!!!!!!!!!!!!!!!!!********!!!!!!!!!*******:mad: :mad: :mad: :mad: :confused: :confused: :mad: :mad: :mad: :mad:
 
Try this

I have created a temp query so it only takes my email (just for a test) change that to your email address and see if you get an email with an excel attachment.

You'll need to change it so that it picks up the subfrm results rather than everything in the table.

Let me know how it goes (this is working here)
 

Attachments

thank you very very much honey! im going to go to an internet cafe now to try and use OUTLOOK!! seen as though im not allowed to here! ill be back!
 
Here you go,

its a simple email sending dll, designed to allow you to set the subject, text, add atachments, send to, CC and BCC

Here is an example of its use

Code:
Private Sub Command1_Click()
    Dim aEmail As New BuildEmail
    aEmail.SetSubject "Hello!"
    aEmail.AddBCC "rudi@taical.co.uk"
    aEmail.AddCC "mattk@taical.co.uk"
    aEmail.AddRecipiant "info@taical.co.uk"
    aEmail.SetText "let me know if you get this." & vbCrLf & vbCrLf & "thanks"
    aEmail.SendAndExit
    
End Sub



To use the dll download the attached file and install, you will need to add the dll as a referece to your code.

[edit]
file to big to upload
[/edit]

once everything is setup send away.




Let me know if you have any problems, as im the person who wrote it. (I havent tested the install package yet)



ShadeZ
 
Last edited:
Lyns: I read somewhere back that the sendobject command does not work with Outlook Express. Also, if you don't already have an email account on the system you are working from, I don't it will work anyway. I use this type of delivery device a lot here at work for sending out notifications, but I can't test any of it on my home computer because it's set up with Outlook Express. This may be of no help, but if it's prompting to set up an account, the system you are on probably won't let you do it.
 
Thanks shadez!

Hay thats still not working at this end when i click on the email button i get a grey screen saying that a program is trying to send an email on your behalf... the to: is empty and subjest says subject then it has send or dont send... if i click on send a time line thing comes up and says message sent then the mesage box appears saying emails have been sent but im not getting the email at all??

1. not getting the email
2. its not asking what i want to attach??
3. where did outlook go i wanted to be able to type a message before i hit send?
 
For what it's worth I can tell you your attemps did work because everytime you tried testing it there I got an email with the attachment. If you want to first view the email before sending you need to set the line that says false to true but that will mean having to click send everytime for all contacts in your subfrm which is not ideal. Is there a number of standard emails you wish to select from each time? You could perhaps store these in a table and use a drop down to select which template you want to use prior to sending the emails which would overcome this problem.

Also I wasn't aware at the time you would need to select a different file each time.
 
Sorry honey! didnt mean to mail you everytime.

is selecting a different file everytime a problem? it will usualy be html file but poss not always.

Hay thanks a million for helping sorry you got all the tests :o :p :eek:

gotta luv me ???:D

Ill try out some different things now on sending the message. thanks honey.

Thanks everyone for all the help (YET again )

:(
 

Users who are viewing this thread

Back
Top Bottom