f



Sending mail through Mail::Outlook

Hi,

I am using Mail::Outlook to send email through Outlook. I've set out
the code below. Everything works fine but I have two items on my wish
list.

1. To be able to send attachments. I have tried
'$message->Attachments('c:\file.txt');' and
'$message->Attachments.Add('c:\file.txt');' but neither work.
2. To be able to send the email in html format but
'$message->HTMLBody($body);' doesn't work.

Are either of these possible using Mail::Outlook or do I need to go
back to scratch and use another module?

Thanks

Paddy

#################################################################################
# CODE

#!/usr/bin/perl

use strict;
use warnings;

use Mail::Outlook;
use Win32::OLE::Const 'Microsoft Outlook';
my $outlook = new Mail::Outlook();

my $to = "my_mom\@moms_mail.com";
my $body = "Hi Mom!\n\n etc.";
my $message = $outlook->create();

$message->To($to);
$message->Cc();
$message->Bcc();
$message->Subject('Happy Mothers Day, Mom!);
$message->Body($body);
#$message->HTMLBody($body);
#$message->Attachments('c:\Card.pdf');
$message->send;

0
5/25/2006 4:22:09 PM
comp.lang.perl.misc 33233 articles. 2 followers. brian (1246) is leader. Post Follow

2 Replies
1288 Views

Similar Articles

[PageSpeed] 22

paddyxmurphy@googlemail.com wrote:

> Hi,
> 
> I am using Mail::Outlook to send email through Outlook. 


Why on Earth would you want to do that?


> I've set out 
> the code below. Everything works fine but I have two items on my wish
> list.
> 
> 1. To be able to send attachments. I have tried
> '$message->Attachments('c:\file.txt');' and
> '$message->Attachments.Add('c:\file.txt');' but neither work.
> 2. To be able to send the email in html format but
> '$message->HTMLBody($body);' doesn't work.



The module's documentation does not mention either $message->Attachments or
$message->HTMLBody.  Have you just made these up in the hope it might work?



> Are either of these possible using Mail::Outlook or do I need to go
> back to scratch and use another module?



Try MIME::Lite.


-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
0
Brian
5/25/2006 4:37:09 PM
"paddyxmurphy@googlemail.com" <paddyxmurphy@googlemail.com> wrote in
news:1148574129.603447.243080@j73g2000cwa.googlegroups.com: 

> I am using Mail::Outlook to send email through Outlook. I've set out
> the code below. Everything works fine but I have two items on my wish
> list.
> 
> 1. To be able to send attachments. I have tried
> '$message->Attachments('c:\file.txt');' and
> '$message->Attachments.Add('c:\file.txt');' but neither work.
> 2. To be able to send the email in html format but
> '$message->HTMLBody($body);' doesn't work.
> 
> Are either of these possible using Mail::Outlook or do I need to go
> back to scratch and use another module?

Unless the only way you can send email is through Outlook, I would 
recommend looking at other modules.

perldoc -q "How do I send mail"

If you *must* use Outlook to send email, looking at Mail::Outlook and 
Mail::Outlook::Message, my instinct is to ditch the module.

Note that an excellent source of information for Microsoft Office 
applications is the Object Browser. You can access it via Tools -> Macro 
-> Visual Basic Editor. Once you are in the editor, hit F2 to browse the 
interfaces, methods, and properties provided by Microsoft Office 
applications.

An example of dealing with Outlook via OLE: 

http://www.unur.com/comp/ppp/perl-win32-ole-outlook-ex1.html

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

0
A
5/25/2006 4:53:39 PM
Reply:

Similar Artilces:

php mail() not sending to mail Clients (ie, Outlook, Apple Mail, thunderbird, etc..)
I have a send mail script on my site that. The emails are recieved by gmail, and yahoo, but not to mail clients like Outlook, Mail, etc...) Is this a problem with the script, or is it something I must change in php ini file? Thanks in advance for any help. here is the code. (im using it in conjunction with javascript for some AJAX stuff) if(!isset($_GET['action'])) { die("You must not access this page directly!"); //Just to stop people from visiting contact.php normally } /* Now lets trim up the input before sending it */ $name = trim($_GET['name']); //The sen...

Mail will not send mail but will receive mail
At work I have a Wallstreet with Jaguar connected to a DSL line. Up until a couple days ago I have been able to use my personal ISP smtp address to send and receive mail. This is not the same company as the DSL provider. A couple days ago I was able to receive posts but not send them. I tried repairing permissions, and trashing the Mail prefs. Finally I emailed my ISP and the response was that I have to use the DSL carrier's smtp address. Yet, I've been using my personal ISP's smtp address for about a year. At home I use a dialup with the ISP and everything works fi...

sending mail otherthan mail()
Hello everyone, My server admin has blocked the mail() due to some spam problems. I need to send emails using php. Can anyone guide me to the best method of sending emails using php without using mail(). If there is any tweak to be done at the server level I will be able to convince the admin. The server has linux Enterprice edition 3 with php 4.3.11 and cpanel/whm. Please guide me to the method and i will be able to collect other information about it from google. Thanks Jaunty Edward smilesinblues@gmail.com wrote: > My server admin has blocked the mail() due to some spam problems. I ...

Send mail script step
I have a file CLASSES with the classes of a school and a file STUDENTS with the students of the shool. The two files are related with the Class_ID field. I have a layout with the data from one record of the CLASS file and a portal showing all the students in that class. I want to use a script to sent e-mails to all the students in that class (assuming that there is a e-mail address field in students file). If I use the "Use all Recordn in found set" flag the mail is sent to all the studends of the school and not only to the students of that class. If I use "Use the current rec...

Mail and imported mail in mail app
I imported my email from an iMac g5 to a MacBook Pro running Leopard. I now have an inbox, sent box, Trash, and underneath that a set of folders I'd created in Mail on the iMac for various mail stuff. Under that is a gmail heading (all my mail comes to Mail app from Gmail), and under that another inbox, sent box. Is there a way to meld these two inboxes? Last time I looked, a new mail coming in showed up in both places, requiring me to select each in turn. Ed In article <C73B46C2.2656D%kearnser@gmail.com>, Ed Kearns <kearnser@gmail.com> wrote: > I imp...

How do I delete mail from mail file /var/mail/su after reading mails
I used to receive data in mail from users. I used to read those data and load that into a ORACLE table. However I am not able to delete those mails after reading and loading it. Currently I delete them manually when the mail file grow very big Is there a way we can delete these mails after we read it using shell script ? ...

Problem with Mail,mail won�t send
My partner has a G4 with OS X 10.3.9. Recently lots of messages have refused to send from her Mail Outbox,resulting in the App beachballing/having to be ForceQuit. Sometimes she gets the following error message:- �This message could not be delivered and will remain in your Outbox until it can be delivered. Verify that you have addressed the msg correctly.Check smtp settings in Mail preferences and verify any advanced setup with your system administrator�. I�ve tried the following things:- Repair permissions Zap PRAM Rebuild Mailboxes Tried trashing Mail prefs but when she tries to log in agai...

Import send mails from Gmail into Mail? How?
I just set up Mail to import the mail from Gmail - but it only imports the inbox. How can I import the 'send mail' folder? TIA Markus Markus Winter <beyonder@blueyonder.co.uk> wrote: > I just set up Mail to import the mail from Gmail - but it only imports > the inbox. How can I import the 'send mail' folder? It doesn't import Gmail, it accesses your Gmail account via their POP server. It's getting your Inbox items by retrieving them from the server, not by importing them. Any messages you send using Mail will go to the Sent box, but as far as I know ...

mail form not sending mail
Hi all, I am trying to test a simple feedback form. I have php 5.0.3.3 on my dev Windows server 2003. SMTP is working fine, as we all use it to send mail from. PHP works fine as well, but I just cant get mail sent by php, although no errors are reported. Do I understand it correctly that this simple script should send me a mail? This is just to test that it works. <?php mail('me@whatever.com', 'My Subject', 'message'); header( "Location: http://webserver/message_sent.htm" ); ?> Okay, the " Location: http://webserver/message_sent.htm" comes ...

Sending HTML mail from VMS MAIL?
Hi guys I think it's doable, if the message if formatted appropriately (I dunno much about mime or html) and possibly sent with MAIL/FOREIGN Can someone give me hints? I'd like to send a mail in HTML so if someone could give an example of a minimal email message. I can send attachments with mime-encoded messages, but I just don't know how to do html. I tried things like: Content-Type: multipart/mixed; charset=ISO-8859-1; boundary=OpenVMS/MIME.553682649.1083347886 Content-Transfer-Encoding: 7bit Message-ID: <553682649.1083347886@OpenVMS>" Content-Disposition: inl...

Send Mail with Apple Mail
FMP 10 on OS 10.6: When I use the send mail script step, I get formattet text in the E-mail. This is funny because the Apple Mail setting for new mails is text only. Any ideas how to get text only mails into Apple Mail? -- Christoph Kaufmann http://clk.ch ...

Pegasus Mail freezes when sending mail
Hello, We have Pegasus Mail version 4.41 set up on a Windows Network. The programs are run in workstation mode so that they are running the executables off the network. We are using a roaming profile. We have one particular computer that intermittently freezes up when sending mail. This workstation is a Windows XP Professional SP2 machine. The program becomes unresponsive (eternal hourglass), and even manually ending the program from task manager won't work. The person using this workstation tells me it seems to happen more when replying to messsages from a user than when ...

Sending mail with mail() without header
Hi, I'm working on a website where there is a from from which I want to send the data by e-mail. When I send myself the result with mail($my_email, $title, $message) everything works fine and I receive a plain text email. However, the people for which I'm doing the site receive some kind of error when I do the same thing but delivered to them > mail($their_email, $title, $message) The error looks something like this: Your message cannot be delivered to the following recipients: Recipient address: services@theirdomain.com Reason: Illegal host/domain name found I also used s...

Why I can not send mail to this mail loop?
hasn't been delivered to the members, including myself. Why I can not send out mail? ...

Web resources about - Sending mail through Mail::Outlook - comp.lang.perl.misc

Resources last updated: 2/3/2016 11:58:22 PM