473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ASPMail - Format email in HTML which has ATTACHMENT

20
hello all,

how can we send an html formatted email which has word ATTACHMENT ???

(is it possible)
Jun 12 '08 #1
11 3018
DrBunchman
979 Expert 512MB
Hi Yash,

Use the following code snippet to help you:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Set myMail=CreateObject("CDO.Message")
  3. myMail.Subject="Sending email with CDO"
  4. myMail.From="mymail@mydomain.com"
  5. myMail.To="yourmail@mydomain.com"
  6. myMail.CreateMHTMLBody "http://www.w3schools.com/asp/" 
  7. myMail.AddAttachment "C:\AttachmentFile.txt"
  8. myMail.Send
  9. set myMail=nothing
  10.  
Hope this helps,

Dr B
Jun 12 '08 #2
yash777
20
hello DR.B,

Actually i m requesting entries from a form and then sending those form elements in formated html (within same page)

following is sample of my code:

Expand|Select|Wrap|Line Numbers
  1. jobcode=TRIM(Request.Form("jobcode"))
  2. jobcategory=TRIM(Request.Form("jobid"))
  3. name=TRIM(Request.Form("f_name"))&" "&TRIM(Request.Form("m_name"))&" "&TRIM(Request.Form("l_name"))
  4. sex=TRIM(Request.Form("gender"))
  5. M_status=TRIM(Request.Form("optMarital"))
  6.  
  7. strbody = "<font face='verdana' size=2>"
  8. strbody = strbody & "<BR><B>Job Code</B> : "&jobcode&" <br>"
  9. strbody = strbody & "<BR><B>Job Category</B> : "&jobcategory&" <br>"
  10. strbody = strbody & "<BR><B>Name</B> : "&name&" <br>"
  11. strbody = strbody & "<BR><B>Gender</B> : "&sex&" <br>"
sending the above strBody as body

Expand|Select|Wrap|Line Numbers
  1. Mailer.BodyText = strBody
  2. Mailer.AddAttachment(...........)
and i m using SMTPsvg mailer.

can it be done within the same page.
Jun 12 '08 #3
DrBunchman
979 Expert 512MB
I don't see why not. You could probably do something like

Expand|Select|Wrap|Line Numbers
  1.  Mailer.ContentType = "text/html" 
  2. Mailer.BodyText = strBody
  3. Mailer.AddAttachment "AttachmentFile.txt"
  4.  
Give it a try and let me know how it goes,

Dr B
Jun 12 '08 #4
yash777
20
hello dr.B,

yes i did the same but when i check the mail it just write that HTML code also,

i read somewere that Mailer.ContentType="text/html" gets omitted when u use attachment.
Jun 12 '08 #5
DrBunchman
979 Expert 512MB
I've just had a quick google and that seems to be the case, certainly with some versions of ASPMail. There is a possible fix here which might help you.

Otherwise have you considered using CDOSYS instead?

Let me know if that link helps you,

Dr B
Jun 12 '08 #6
yash777
20
NO, it's not helpful.

Any other way to do this????

don't have any idea about CDOSYS............

How can we do this using CDOSYS ??
Jun 12 '08 #7
DrBunchman
979 Expert 512MB
CDOSYS is a mail object just like ASPMail.

Try the code below and let me know if it works.
Expand|Select|Wrap|Line Numbers
  1.  Set myMail=CreateObject("CDO.Message") 
  2. myMail.Subject="Sending email with CDO"
  3. myMail.From=mymail@mydomain.com
  4. myMail.To=yourmail@mydomain.com
  5. myMail.HTMLBody = strBody
  6. myMail.AddAttachment "C:\AttachmentFile.txt"
  7. myMail.Send
  8. set myMail=nothing
  9.  
Dr B
Jun 12 '08 #8
yash777
20
thank u for ur reply,

actually i dont know all properties of CDOSYS like

Expand|Select|Wrap|Line Numbers
  1. Mailer.FromName = 
  2. Mailer.FromAddress = 
  3. Mailer.RemoteHost =  
  4. Mailer.ReturnReceipt = true
  5. Mailer.ConfirmRead = false
  6. Mailer.Priority = 0
  7. Mailer.Subject = subject
  8. Mailer.ContentType = "text/html"
  9. Mailer.BodyText = strBody
  10. Mailer.ClearRecipients        
  11. Mailer.AddRecipient 
  12. Mailer.AddRecipient 
  13. Mailer.AddAttachment
  14. Mailer.SendMail
i will google it a bit and then let u know whether it is working or not.

and also my office timing is over.

SO.. thanx for ur support, hope will clear this tomorrow.

thanx again.
Jun 12 '08 #9
DrBunchman
979 Expert 512MB
No problem, check out w3Schools for some of the properties but there are loads of resources out there.

Dr B
Jun 12 '08 #10
yash777
20
hello DR.B,

thanx a lot for ur support.

i did it with CDOSYS, it's working fine for me.

thanx again..

keep replying.
Jun 13 '08 #11
DrBunchman
979 Expert 512MB
Excellent Yash! Glad you got it sorted out.

Dr B
Jun 13 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sam | last post by:
Hi, I want to be able to send an email w/ attachment. I have an INPUT Type="File" HTMLControl on the page. User selects the attachment using this control. That's where I'm stuck. First, I...
5
by: Das | last post by:
Hi, I'm trying to email html page & that page also contains the images. I can do that when we send html page from ms outlook. But I want to attach page c# code & send the mail through smtp mail....
2
by: kamlai | last post by:
I'm using PHP 5 with apache in linux. I'm now have a $content which stores the content of the email in HTML format. I would like to send this $content as the attachment of the email. How to deal...
0
by: russel | last post by:
how do i read html attachment through vb
0
by: russel | last post by:
well i wll be downloading a html attachment ,after opening it in a rtbbonx in vb i need the code to read the contents of the html attchment which contains various rows and multiple coloumn i need...
1
by: Second Chance | last post by:
I have an application in php/html/javascript, part of which has to generate an email with attachment. I have done this via php, but now my customer wants the email to appear in Outlook, (so he can...
0
by: prasenjit2007 | last post by:
I have a main form for inputing the (to/from/mesg/file) with the following code:- <html> <body> <table> <tr> <td>To:</td> <td><input type="text" name="to" size="50" ...
1
by: Dreea | last post by:
Hy all.... I tried several functions found on the internet and i don't seem to figure what the problem is... this is one of the example i tryied function sendMail($sendto, $subject, $message,...
4
by: PleaseHelpMe | last post by:
Any1 can tell me how to go about sending email with attachment in vb programming code. I know SMTP is one option, but I can't seem to get it working. Any other suggestion?? Thanks in advance
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.