Complete example snippets
Moderators: Chris Corbyn, General Moderators
Complete example snippets
I stumbled across Swift while looking for a quick and easy way to send mail from my web site. I really hadn't planned on becoming an email expert, just some essential communications with my clients.
Installed swift just like it said and ran the smoke test. Perfect, did everything I needed it to do.
Constructing a usable script, however, isn't quite as apparent as it seems to be. The examples are delivered across a series of categories and I am sure quite clear for the experienced. What I am hoping I can accomplish here is get a clear functioning (and complete) example for my needs so I can move on.
My situation is this:
I need to send to a client, I have.
$to = "to";
$from = "me";
$subject = "whatever";
$message = "what I have to say";
I need to authenticate to a remote smtp server:
$server = "server.domain.com";
$user = "my account name";
$upass= "my account pass";
My needs are simple, but I am not making a lot of sense out of the examples. Does anyone have or can point me to a functioning example for the information I have and how to get the thing out the door?
The only other variation I would have at some point is the need to send to multiple receivers on my active list (doesn't happen much) - but I suspect I can simply loop it?
Any help would be appreciated.
Installed swift just like it said and ran the smoke test. Perfect, did everything I needed it to do.
Constructing a usable script, however, isn't quite as apparent as it seems to be. The examples are delivered across a series of categories and I am sure quite clear for the experienced. What I am hoping I can accomplish here is get a clear functioning (and complete) example for my needs so I can move on.
My situation is this:
I need to send to a client, I have.
$to = "to";
$from = "me";
$subject = "whatever";
$message = "what I have to say";
I need to authenticate to a remote smtp server:
$server = "server.domain.com";
$user = "my account name";
$upass= "my account pass";
My needs are simple, but I am not making a lot of sense out of the examples. Does anyone have or can point me to a functioning example for the information I have and how to get the thing out the door?
The only other variation I would have at some point is the need to send to multiple receivers on my active list (doesn't happen much) - but I suspect I can simply loop it?
Any help would be appreciated.
Last edited by Joehoch on Tue Jan 20, 2009 9:30 pm, edited 1 time in total.
Re: Complete example snippets
Oh incidentally..
I am on a windows box - using php5 and swift 3.3.3 for php5
I am on a windows box - using php5 and swift 3.3.3 for php5
Re: Complete example snippets
Nobody?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Complete example snippets
[EDIT | Apologies, I mixed your thread up with somebody elses]
You're asking for something very specific and basically Swift Mailer isn't designed in the way that mean there's a set way to do something.
That said, I have planned chapters in the documentation for the new version which will include both tutorials and usage patterns.
You're asking for something very specific and basically Swift Mailer isn't designed in the way that mean there's a set way to do something.
That said, I have planned chapters in the documentation for the new version which will include both tutorials and usage patterns.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Complete example snippets
Without having somebody build the entire thing for you, could you perhaps share what it is you're getting stuck on?
Have you been able to send a single email (not from a form, just the basic email tutorial in the wiki)?
Have you been able to send a single email (not from a form, just the basic email tutorial in the wiki)?
Re: Complete example snippets
I'd like to just be able to find the wiki.
No Chris, I am getting nowhere fast. This whole thing is so far above my level of understanding it's embarrassing.
I started out trying to build something just from the document examples, by adding code to a test script as I worked down the list. That's just making a mess.
As I mentioned in my first post, I am not looking for a lot of capability variety, just looking for a very basic functioning example that I could use to modify into something usable for my purposes.
Frankly I could get away with php's embedded Mail() is it weren't for the need to authenticate to a remote mail system. That one complication is what has sent me looking for something to make quick use out of. As you can tell, php development is not my normal gig.
In mail() this works:
$subject = "Email Verification for submission ".$_POST['reg_user'];
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: Music Archives <admin@".$domain.".com>\n";
@mail($_POST['reg_email'], $subject, $message, $headers);
As I mentioned, the bad is (as you know) that mail() does not provide for smtp / authentication. I just need to do the above plus:
$smtp =& new Swift_Connection_SMTP("outbound.services.net");
$smtp->setUsername("use");
$smtp->setPassword("pass");
Yes, I know I can't mix them. Just showing you what I am attempting to accomplish. I figured surely there was some fully functional example somewhere to accomplish this task. However, that basic example eludes me.
No Chris, I am getting nowhere fast. This whole thing is so far above my level of understanding it's embarrassing.
I started out trying to build something just from the document examples, by adding code to a test script as I worked down the list. That's just making a mess.
As I mentioned in my first post, I am not looking for a lot of capability variety, just looking for a very basic functioning example that I could use to modify into something usable for my purposes.
Frankly I could get away with php's embedded Mail() is it weren't for the need to authenticate to a remote mail system. That one complication is what has sent me looking for something to make quick use out of. As you can tell, php development is not my normal gig.
In mail() this works:
$subject = "Email Verification for submission ".$_POST['reg_user'];
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: Music Archives <admin@".$domain.".com>\n";
@mail($_POST['reg_email'], $subject, $message, $headers);
As I mentioned, the bad is (as you know) that mail() does not provide for smtp / authentication. I just need to do the above plus:
$smtp =& new Swift_Connection_SMTP("outbound.services.net");
$smtp->setUsername("use");
$smtp->setPassword("pass");
Yes, I know I can't mix them. Just showing you what I am attempting to accomplish. I figured surely there was some fully functional example somewhere to accomplish this task. However, that basic example eludes me.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Complete example snippets
Is your question just how to send an email over SMTP, using authentication?
Take this example:
http://swiftmailer.org/wikidocs/v3/tutorials/basic
Then modify the line:
According the the page that explains using authentication:
http://swiftmailer.org/wikidocs/v3/smtpauth
Take this example:
http://swiftmailer.org/wikidocs/v3/tutorials/basic
Then modify the line:
Code: Select all
//Start Swift
$swift =& new Swift(new Swift_Connection_SMTP("smtp.your-host.tld"));
http://swiftmailer.org/wikidocs/v3/smtpauth
Code: Select all
$smtp = new Swift_Connection_SMTP('smtp.your-host.tld');
$smtp->setUsername('username here');
$smtp->setPassword('password here');
$swift = new Swift($smtp);Re: Complete example snippets
My apologies Chris..
Guess I was trying to overtake the plumbing. It was much easier than I thought at first glance. See I was attempting to take ALL those sections and combine them into a monster. Not good.
Just using those two sections you pointed out, it worked. Sorry to steal your time.
> Joe
Guess I was trying to overtake the plumbing. It was much easier than I thought at first glance. See I was attempting to take ALL those sections and combine them into a monster. Not good.
Just using those two sections you pointed out, it worked. Sorry to steal your time.
> Joe